@squide/firefly 16.1.3 → 16.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/FireflyRuntime.js +6 -12
- package/dist/FireflyRuntime.js.map +1 -1
- package/package.json +23 -23
- package/src/FireflyRuntime.tsx +6 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @squide/firefly
|
|
2
2
|
|
|
3
|
+
## 16.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#369](https://github.com/workleap/wl-squide/pull/369) [`a7fc49e`](https://github.com/workleap/wl-squide/commit/a7fc49ed2b111189cc310100482c1fcf37cfad58) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Bumped dependencies.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`a7fc49e`](https://github.com/workleap/wl-squide/commit/a7fc49ed2b111189cc310100482c1fcf37cfad58)]:
|
|
10
|
+
- @squide/launch-darkly@1.0.4
|
|
11
|
+
- @squide/react-router@8.1.10
|
|
12
|
+
- @squide/env-vars@1.4.13
|
|
13
|
+
- @squide/core@6.1.10
|
|
14
|
+
- @squide/msw@4.0.11
|
|
15
|
+
|
|
16
|
+
## 16.1.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#365](https://github.com/workleap/wl-squide/pull/365) [`992dd28`](https://github.com/workleap/wl-squide/commit/992dd28ce8aa03559c556f24df4ebc9c3129c943) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added memoize to the plugin retrieval code.
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`992dd28`](https://github.com/workleap/wl-squide/commit/992dd28ce8aa03559c556f24df4ebc9c3129c943)]:
|
|
23
|
+
- @squide/core@6.1.9
|
|
24
|
+
- @squide/env-vars@1.4.12
|
|
25
|
+
- @squide/launch-darkly@1.0.3
|
|
26
|
+
- @squide/msw@4.0.10
|
|
27
|
+
- @squide/react-router@8.1.9
|
|
28
|
+
|
|
3
29
|
## 16.1.3
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/FireflyRuntime.js
CHANGED
|
@@ -44,8 +44,7 @@ class FireflyRuntime extends ReactRouterRuntime {
|
|
|
44
44
|
return this.#isMswEnabled;
|
|
45
45
|
}
|
|
46
46
|
get mswState() {
|
|
47
|
-
|
|
48
|
-
return plugin.mswState;
|
|
47
|
+
return getMswPlugin(this).mswState;
|
|
49
48
|
}
|
|
50
49
|
registerRequestHandlers(handlers, options = {}) {
|
|
51
50
|
const logger = this._getLogger(options);
|
|
@@ -59,24 +58,19 @@ class FireflyRuntime extends ReactRouterRuntime {
|
|
|
59
58
|
}
|
|
60
59
|
// Must define a return type otherwise we get an "error TS2742: The inferred type of 'requestHandlers' cannot be named" error.
|
|
61
60
|
get requestHandlers() {
|
|
62
|
-
|
|
63
|
-
return plugin.requestHandlers;
|
|
61
|
+
return getMswPlugin(this).requestHandlers;
|
|
64
62
|
}
|
|
65
63
|
getEnvironmentVariable(key) {
|
|
66
|
-
|
|
67
|
-
return plugin.getVariable(key);
|
|
64
|
+
return getEnvironmentVariablesPlugin(this).getVariable(key);
|
|
68
65
|
}
|
|
69
66
|
get environmentVariables() {
|
|
70
|
-
|
|
71
|
-
return plugin.getVariables();
|
|
67
|
+
return getEnvironmentVariablesPlugin(this).getVariables();
|
|
72
68
|
}
|
|
73
69
|
registerEnvironmentVariable(key, value) {
|
|
74
|
-
|
|
75
|
-
return plugin.registerVariable(key, value);
|
|
70
|
+
return getEnvironmentVariablesPlugin(this).registerVariable(key, value);
|
|
76
71
|
}
|
|
77
72
|
registerEnvironmentVariables(variables) {
|
|
78
|
-
|
|
79
|
-
return plugin.registerVariables(variables);
|
|
73
|
+
return getEnvironmentVariablesPlugin(this).registerVariables(variables);
|
|
80
74
|
}
|
|
81
75
|
get appRouterStore() {
|
|
82
76
|
return this.#appRouterStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FireflyRuntime.js","sources":["../src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { EnvironmentVariableKey, EnvironmentVariables, getEnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { FeatureFlagKey, FeatureFlags, FeatureFlagSetSnapshot, getLaunchDarklyPlugin, LaunchDarklyPluginName } from \"@squide/launch-darkly\";\nimport { getMswPlugin, MswPluginName, MswState } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\nimport type { RequestHandler } from \"msw\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions<TRuntime extends FireflyRuntime = FireflyRuntime> extends RuntimeOptions<TRuntime> {\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n get isMswEnabled(): boolean;\n get mswState(): MswState;\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]): void;\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>): void;\n getEnvironmentVariable<T extends EnvironmentVariableKey>(key: T): EnvironmentVariables[T];\n get environmentVariables(): EnvironmentVariables;\n get appRouterStore(): AppRouterStore;\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;\n get isLaunchDarklyEnabled(): boolean;\n get launchDarklyClient(): LDClient;\n get featureFlags(): FeatureFlags;\n getFeatureFlag(key: string, defaultValue?: unknown): unknown;\n get featureFlagSetSnapshot(): FeatureFlagSetSnapshot;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class FireflyRuntime<TRuntime extends FireflyRuntime = any> extends ReactRouterRuntime<TRuntime> implements IFireflyRuntime {\n readonly #appRouterStore: AppRouterStore;\n readonly #honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;\n readonly #isMswEnabled: boolean;\n readonly #isLaunchDarklyEnabled: boolean;\n\n constructor(options: FireflyRuntimeOptions = {}) {\n const {\n honeycombInstrumentationClient\n } = options;\n\n super(options);\n\n this.#appRouterStore = createAppRouterStore(this._logger);\n this.#honeycombInstrumentationClient = honeycombInstrumentationClient;\n this.#isMswEnabled = this._plugins.some(x => x.name === MswPluginName);\n this.#isLaunchDarklyEnabled = this._plugins.some(x => x.name === LaunchDarklyPluginName);\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get isMswEnabled() {\n return this.#isMswEnabled;\n }\n\n get mswState() {\n const plugin = getMswPlugin(this);\n\n return plugin.mswState;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const plugin = getMswPlugin(this);\n\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n plugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const plugin = getMswPlugin(this);\n\n return plugin.requestHandlers;\n }\n\n getEnvironmentVariable(key: EnvironmentVariableKey) {\n const plugin = getEnvironmentVariablesPlugin(this);\n\n return plugin.getVariable(key);\n }\n\n get environmentVariables() {\n const plugin = getEnvironmentVariablesPlugin(this);\n\n return plugin.getVariables();\n }\n\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]) {\n const plugin = getEnvironmentVariablesPlugin(this);\n\n return plugin.registerVariable(key, value);\n }\n\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>) {\n const plugin = getEnvironmentVariablesPlugin(this);\n\n return plugin.registerVariables(variables);\n }\n\n get appRouterStore() {\n return this.#appRouterStore;\n }\n\n get honeycombInstrumentationClient() {\n return this.#honeycombInstrumentationClient;\n }\n\n get isLaunchDarklyEnabled() {\n return this.#isLaunchDarklyEnabled;\n }\n\n get launchDarklyClient() {\n return getLaunchDarklyPlugin(this).client;\n }\n\n get featureFlags() {\n return this.featureFlagSetSnapshot.value;\n }\n\n getFeatureFlag<T extends FeatureFlagKey>(key: T, defaultValue?: FeatureFlags[T]) {\n return getLaunchDarklyPlugin(this).getFeatureFlag(key, defaultValue);\n }\n\n get featureFlagSetSnapshot() {\n return getLaunchDarklyPlugin(this).featureFlagSetSnapshot;\n }\n\n startScope(logger: Logger): TRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as TRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n\n get mswState() {\n return this._runtime.mswState;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n getEnvironmentVariable(key: EnvironmentVariableKey) {\n return this._runtime.getEnvironmentVariable(key);\n }\n\n get environmentVariables() {\n return this._runtime.environmentVariables;\n }\n\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]) {\n this._runtime.registerEnvironmentVariable(key, value);\n }\n\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>) {\n this._runtime.registerEnvironmentVariables(variables);\n }\n\n get appRouterStore(): AppRouterStore {\n throw new Error(\"[squide] Cannot retrieve the app router store from a runtime scope instance.\");\n }\n\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient {\n throw new Error(\"[squide] Cannot retrieve the Honeycomb instrumentation client from a runtime scope instance.\");\n }\n\n get isLaunchDarklyEnabled() {\n return this._runtime.isLaunchDarklyEnabled;\n }\n\n get launchDarklyClient() {\n return this._runtime.launchDarklyClient;\n }\n\n get featureFlags() {\n return this._runtime.featureFlags;\n }\n\n getFeatureFlag<T extends FeatureFlagKey>(key: T, defaultValue?: FeatureFlags[T]) {\n // The error is because the FeatureFlags interface is empty as it is expected to be augmented by the\n // consumer application.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return this._runtime.getFeatureFlag(key, defaultValue);\n }\n\n get featureFlagSetSnapshot() {\n return this._runtime.featureFlagSetSnapshot;\n }\n}\n"],"names":["getEnvironmentVariablesPlugin","getLaunchDarklyPlugin","LaunchDarklyPluginName","getMswPlugin","MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","createAppRouterStore","FireflyRuntime","options","honeycombInstrumentationClient","x","route","Error","plugin","handlers","logger","key","value","variables","defaultValue","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;;;;;;;AAC+G;AAC6B;AACxE;AACqD;AAKzC;AA0BhF,8DAA8D;AACvD,MAAMQ,uBAA8DH,kBAAkBA;IAChF,eAAe,CAAiB;IAChC,+BAA+B,CAAoD;IACnF,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAEzC,YAAYI,UAAiC,CAAC,CAAC,CAAE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QAC5B;IACJ;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe;IACxC;IAEA,uBAAuBQ,GAA2B,EAAE;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAACA;IAChD;IAEA,IAAI,uBAAuB;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,oBAAoB;IAC7C;IAEA,4BAA8DA,GAAM,EAAEC,KAA8B,EAAE;QAClG,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAACD,KAAKC;IACnD;IAEA,6BAA6BC,SAAwC,EAAE;QACnE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAACA;IAC/C;IAEA,IAAI,iBAAiC;QACjC,MAAM,IAAIN,MAAM;IACpB;IAEA,IAAI,iCAAwE;QACxE,MAAM,IAAIA,MAAM;IACpB;IAEA,IAAI,wBAAwB;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB;IAC9C;IAEA,IAAI,qBAAqB;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB;IAC3C;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;IACrC;IAEA,eAAyCI,GAAM,EAAEG,YAA8B,EAAE;QAC7E,oGAAoG;QACpG,wBAAwB;QACxB,6DAA6D;QAC7D,aAAa;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAACH,KAAKG;IAC7C;IAEA,IAAI,yBAAyB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB;IAC/C;AACJ"}
|
|
1
|
+
{"version":3,"file":"FireflyRuntime.js","sources":["../src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { EnvironmentVariableKey, EnvironmentVariables, getEnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { FeatureFlagKey, FeatureFlags, FeatureFlagSetSnapshot, getLaunchDarklyPlugin, LaunchDarklyPluginName } from \"@squide/launch-darkly\";\nimport { getMswPlugin, MswPluginName, MswState } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\nimport type { RequestHandler } from \"msw\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions<TRuntime extends FireflyRuntime = FireflyRuntime> extends RuntimeOptions<TRuntime> {\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n get isMswEnabled(): boolean;\n get mswState(): MswState;\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]): void;\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>): void;\n getEnvironmentVariable<T extends EnvironmentVariableKey>(key: T): EnvironmentVariables[T];\n get environmentVariables(): EnvironmentVariables;\n get appRouterStore(): AppRouterStore;\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;\n get isLaunchDarklyEnabled(): boolean;\n get launchDarklyClient(): LDClient;\n get featureFlags(): FeatureFlags;\n getFeatureFlag(key: string, defaultValue?: unknown): unknown;\n get featureFlagSetSnapshot(): FeatureFlagSetSnapshot;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class FireflyRuntime<TRuntime extends FireflyRuntime = any> extends ReactRouterRuntime<TRuntime> implements IFireflyRuntime {\n readonly #appRouterStore: AppRouterStore;\n readonly #honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;\n readonly #isMswEnabled: boolean;\n readonly #isLaunchDarklyEnabled: boolean;\n\n constructor(options: FireflyRuntimeOptions = {}) {\n const {\n honeycombInstrumentationClient\n } = options;\n\n super(options);\n\n this.#appRouterStore = createAppRouterStore(this._logger);\n this.#honeycombInstrumentationClient = honeycombInstrumentationClient;\n this.#isMswEnabled = this._plugins.some(x => x.name === MswPluginName);\n this.#isLaunchDarklyEnabled = this._plugins.some(x => x.name === LaunchDarklyPluginName);\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get isMswEnabled() {\n return this.#isMswEnabled;\n }\n\n get mswState() {\n return getMswPlugin(this).mswState;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const plugin = getMswPlugin(this);\n\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n plugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n return getMswPlugin(this).requestHandlers;\n }\n\n getEnvironmentVariable(key: EnvironmentVariableKey) {\n return getEnvironmentVariablesPlugin(this).getVariable(key);\n }\n\n get environmentVariables() {\n return getEnvironmentVariablesPlugin(this).getVariables();\n }\n\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]) {\n return getEnvironmentVariablesPlugin(this).registerVariable(key, value);\n }\n\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>) {\n return getEnvironmentVariablesPlugin(this).registerVariables(variables);\n }\n\n get appRouterStore() {\n return this.#appRouterStore;\n }\n\n get honeycombInstrumentationClient() {\n return this.#honeycombInstrumentationClient;\n }\n\n get isLaunchDarklyEnabled() {\n return this.#isLaunchDarklyEnabled;\n }\n\n get launchDarklyClient() {\n return getLaunchDarklyPlugin(this).client;\n }\n\n get featureFlags() {\n return this.featureFlagSetSnapshot.value;\n }\n\n getFeatureFlag<T extends FeatureFlagKey>(key: T, defaultValue?: FeatureFlags[T]) {\n return getLaunchDarklyPlugin(this).getFeatureFlag(key, defaultValue);\n }\n\n get featureFlagSetSnapshot() {\n return getLaunchDarklyPlugin(this).featureFlagSetSnapshot;\n }\n\n startScope(logger: Logger): TRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as TRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n\n get mswState() {\n return this._runtime.mswState;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n getEnvironmentVariable(key: EnvironmentVariableKey) {\n return this._runtime.getEnvironmentVariable(key);\n }\n\n get environmentVariables() {\n return this._runtime.environmentVariables;\n }\n\n registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]) {\n this._runtime.registerEnvironmentVariable(key, value);\n }\n\n registerEnvironmentVariables(variables: Partial<EnvironmentVariables>) {\n this._runtime.registerEnvironmentVariables(variables);\n }\n\n get appRouterStore(): AppRouterStore {\n throw new Error(\"[squide] Cannot retrieve the app router store from a runtime scope instance.\");\n }\n\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient {\n throw new Error(\"[squide] Cannot retrieve the Honeycomb instrumentation client from a runtime scope instance.\");\n }\n\n get isLaunchDarklyEnabled() {\n return this._runtime.isLaunchDarklyEnabled;\n }\n\n get launchDarklyClient() {\n return this._runtime.launchDarklyClient;\n }\n\n get featureFlags() {\n return this._runtime.featureFlags;\n }\n\n getFeatureFlag<T extends FeatureFlagKey>(key: T, defaultValue?: FeatureFlags[T]) {\n // The error is because the FeatureFlags interface is empty as it is expected to be augmented by the\n // consumer application.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return this._runtime.getFeatureFlag(key, defaultValue);\n }\n\n get featureFlagSetSnapshot() {\n return this._runtime.featureFlagSetSnapshot;\n }\n}\n"],"names":["getEnvironmentVariablesPlugin","getLaunchDarklyPlugin","LaunchDarklyPluginName","getMswPlugin","MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","createAppRouterStore","FireflyRuntime","options","honeycombInstrumentationClient","x","route","Error","handlers","logger","plugin","key","value","variables","defaultValue","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;;;;;;;AAC+G;AAC6B;AACxE;AACqD;AAKzC;AA0BhF,8DAA8D;AACvD,MAAMQ,uBAA8DH,kBAAkBA;IAChF,eAAe,CAAiB;IAChC,+BAA+B,CAAoD;IACnF,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAEzC,YAAYI,UAAiC,CAAC,CAAC,CAAE;QAC7C,MAAM,EACFC,8BAA8B,EACjC,GAAGD;QAEJ,KAAK,CAACA;QAEN,IAAI,CAAC,eAAe,GAAGF,oBAAoBA,CAAC,IAAI,CAAC,OAAO;QACxD,IAAI,CAAC,+BAA+B,GAAGG;QACvC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAACC,CAAAA,IAAKA,EAAE,IAAI,KAAKP,aAAaA;QACrE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAACO,CAAAA,IA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iC;QACjC,MAAM,IAAIN,MAAM;IACpB;IAEA,IAAI,iCAAwE;QACxE,MAAM,IAAIA,MAAM;IACpB;IAEA,IAAI,wBAAwB;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB;IAC9C;IAEA,IAAI,qBAAqB;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB;IAC3C;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;IACrC;IAEA,eAAyCI,GAAM,EAAEG,YAA8B,EAAE;QAC7E,oGAAoG;QACpG,wBAAwB;QACxB,6DAA6D;QAC7D,aAAa;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAACH,KAAKG;IAC7C;IAEA,IAAI,yBAAyB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB;IAC/C;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "16.1.
|
|
4
|
+
"version": "16.1.5",
|
|
5
5
|
"description": "Squide bundle for the firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@opentelemetry/api": "^1.9.0",
|
|
36
|
-
"@tanstack/react-query": "^5.90.
|
|
36
|
+
"@tanstack/react-query": "^5.90.17",
|
|
37
37
|
"launchdarkly-js-client-sdk": "^3.9.0",
|
|
38
|
-
"msw": "^2.12.
|
|
38
|
+
"msw": "^2.12.7",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
40
40
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
41
|
-
"react-router": "^7.
|
|
41
|
+
"react-router": "^7.12.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@opentelemetry/api": {
|
|
@@ -46,32 +46,32 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@workleap-telemetry/core": "^1.0.
|
|
50
|
-
"@workleap/logging": "^1.3.
|
|
49
|
+
"@workleap-telemetry/core": "^1.0.7",
|
|
50
|
+
"@workleap/logging": "^1.3.4",
|
|
51
51
|
"uuid": "^13.0.0",
|
|
52
|
-
"@squide/core": "6.1.
|
|
53
|
-
"@squide/env-vars": "1.4.
|
|
54
|
-
"@squide/launch-darkly": "1.0.
|
|
55
|
-
"@squide/msw": "4.0.
|
|
56
|
-
"@squide/react-router": "8.1.
|
|
52
|
+
"@squide/core": "6.1.10",
|
|
53
|
+
"@squide/env-vars": "1.4.13",
|
|
54
|
+
"@squide/launch-darkly": "1.0.4",
|
|
55
|
+
"@squide/msw": "4.0.11",
|
|
56
|
+
"@squide/react-router": "8.1.10"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@eslint/js": "9.39.
|
|
60
|
-
"@rsbuild/core": "1.
|
|
61
|
-
"@rslib/core": "0.
|
|
62
|
-
"@testing-library/react": "16.3.
|
|
63
|
-
"@types/react": "19.2.
|
|
59
|
+
"@eslint/js": "9.39.2",
|
|
60
|
+
"@rsbuild/core": "1.7.2",
|
|
61
|
+
"@rslib/core": "0.19.2",
|
|
62
|
+
"@testing-library/react": "16.3.1",
|
|
63
|
+
"@types/react": "19.2.8",
|
|
64
64
|
"@types/react-dom": "19.2.3",
|
|
65
|
-
"@typescript-eslint/parser": "8.
|
|
65
|
+
"@typescript-eslint/parser": "8.53.0",
|
|
66
66
|
"@vitejs/plugin-react": "5.1.2",
|
|
67
|
-
"@workleap/eslint-configs": "1.1.
|
|
68
|
-
"@workleap/rslib-configs": "1.1.
|
|
67
|
+
"@workleap/eslint-configs": "1.1.9",
|
|
68
|
+
"@workleap/rslib-configs": "1.1.5",
|
|
69
69
|
"@workleap/typescript-configs": "3.0.7",
|
|
70
|
-
"eslint": "9.39.
|
|
71
|
-
"happy-dom": "20.0
|
|
70
|
+
"eslint": "9.39.2",
|
|
71
|
+
"happy-dom": "20.3.0",
|
|
72
72
|
"typescript": "5.9.3",
|
|
73
|
-
"typescript-eslint": "8.
|
|
74
|
-
"vitest": "4.0.
|
|
73
|
+
"typescript-eslint": "8.53.0",
|
|
74
|
+
"vitest": "4.0.17"
|
|
75
75
|
},
|
|
76
76
|
"sideEffects": false,
|
|
77
77
|
"scripts": {
|
package/src/FireflyRuntime.tsx
CHANGED
|
@@ -66,9 +66,7 @@ export class FireflyRuntime<TRuntime extends FireflyRuntime = any> extends React
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
get mswState() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return plugin.mswState;
|
|
69
|
+
return getMswPlugin(this).mswState;
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {
|
|
@@ -86,33 +84,23 @@ export class FireflyRuntime<TRuntime extends FireflyRuntime = any> extends React
|
|
|
86
84
|
|
|
87
85
|
// Must define a return type otherwise we get an "error TS2742: The inferred type of 'requestHandlers' cannot be named" error.
|
|
88
86
|
get requestHandlers(): RequestHandler[] {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return plugin.requestHandlers;
|
|
87
|
+
return getMswPlugin(this).requestHandlers;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
90
|
getEnvironmentVariable(key: EnvironmentVariableKey) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return plugin.getVariable(key);
|
|
91
|
+
return getEnvironmentVariablesPlugin(this).getVariable(key);
|
|
98
92
|
}
|
|
99
93
|
|
|
100
94
|
get environmentVariables() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return plugin.getVariables();
|
|
95
|
+
return getEnvironmentVariablesPlugin(this).getVariables();
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
registerEnvironmentVariable<T extends EnvironmentVariableKey>(key: T, value: EnvironmentVariables[T]) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return plugin.registerVariable(key, value);
|
|
99
|
+
return getEnvironmentVariablesPlugin(this).registerVariable(key, value);
|
|
110
100
|
}
|
|
111
101
|
|
|
112
102
|
registerEnvironmentVariables(variables: Partial<EnvironmentVariables>) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return plugin.registerVariables(variables);
|
|
103
|
+
return getEnvironmentVariablesPlugin(this).registerVariables(variables);
|
|
116
104
|
}
|
|
117
105
|
|
|
118
106
|
get appRouterStore() {
|