@squide/firefly-rsbuild-storybook 2.0.7 → 2.1.1
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 +23 -0
- package/dist/StorybookRuntime.js +0 -2
- package/dist/StorybookRuntime.js.map +1 -1
- package/dist/index.js +4 -11
- package/dist/index.js.map +1 -1
- package/dist/initializeFireflyForStorybook.js +0 -5
- package/dist/initializeFireflyForStorybook.js.map +1 -1
- package/dist/withFeatureFlagsOverrideDecorator.js +0 -4
- package/dist/withFeatureFlagsOverrideDecorator.js.map +1 -1
- package/dist/withFireflyDecorator.js +2 -6
- package/dist/withFireflyDecorator.js.map +1 -1
- package/package.json +26 -25
- package/src/withFireflyDecorator.tsx +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @squide/firefly-rsbuild-storybook
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#575](https://github.com/workleap/wl-squide/pull/575) [`9c91bd4`](https://github.com/workleap/wl-squide/commit/9c91bd47c5357a2b15b1fb0e984f81687a3b8b53) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Bump dependencies
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9c91bd4`](https://github.com/workleap/wl-squide/commit/9c91bd47c5357a2b15b1fb0e984f81687a3b8b53)]:
|
|
10
|
+
- @squide/launch-darkly@1.0.11
|
|
11
|
+
- @squide/env-vars@1.4.20
|
|
12
|
+
- @squide/firefly@16.2.2
|
|
13
|
+
- @squide/msw@4.0.18
|
|
14
|
+
|
|
15
|
+
## 2.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#559](https://github.com/workleap/wl-squide/pull/559) [`33b1cd6`](https://github.com/workleap/wl-squide/commit/33b1cd639ef97e9d9fc892918ab6cbd08e6b91e9) Thanks [@patricklafrance](https://github.com/patricklafrance)! - React Router loaders execution is now delayed until MSW is ready.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`33b1cd6`](https://github.com/workleap/wl-squide/commit/33b1cd639ef97e9d9fc892918ab6cbd08e6b91e9)]:
|
|
24
|
+
- @squide/firefly@16.2.0
|
|
25
|
+
|
|
3
26
|
## 2.0.7
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/StorybookRuntime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorybookRuntime.js","sources":["../src/StorybookRuntime.ts"],"sourcesContent":["import { FireflyRuntime, FireflyRuntimeOptions, FireflyRuntimeScope } from \"@squide/firefly\";\nimport { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { Logger } from \"@workleap/logging\";\n\nexport class StorybookRuntime extends FireflyRuntime {\n constructor(options: FireflyRuntimeOptions = {}) {\n const {\n honeycombInstrumentationClient\n } = options;\n\n if (honeycombInstrumentationClient) {\n throw new Error(\"[squide] A StorybookRuntime instance should not receive an Honeycomb client.\");\n }\n\n super(options);\n }\n\n registerRoute() {\n // Ignore routes registration because it doesn't matter for a Storybook host application.\n }\n\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient {\n throw new Error(\"[squide] Cannot retrieve the Honeycomb instrumentation client from a StorybookRuntime instance.\");\n }\n\n startScope(logger: Logger) {\n return (new StorybookRuntimeScope(this, logger) as unknown) as StorybookRuntime;\n }\n}\n\nexport class StorybookRuntimeScope extends FireflyRuntimeScope { }\n"],"names":["FireflyRuntime","FireflyRuntimeScope","StorybookRuntime","options","honeycombInstrumentationClient","Error","logger","StorybookRuntimeScope"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorybookRuntime.js","sources":["../src/StorybookRuntime.ts"],"sourcesContent":["import { FireflyRuntime, FireflyRuntimeOptions, FireflyRuntimeScope } from \"@squide/firefly\";\nimport { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { Logger } from \"@workleap/logging\";\n\nexport class StorybookRuntime extends FireflyRuntime {\n constructor(options: FireflyRuntimeOptions = {}) {\n const {\n honeycombInstrumentationClient\n } = options;\n\n if (honeycombInstrumentationClient) {\n throw new Error(\"[squide] A StorybookRuntime instance should not receive an Honeycomb client.\");\n }\n\n super(options);\n }\n\n registerRoute() {\n // Ignore routes registration because it doesn't matter for a Storybook host application.\n }\n\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient {\n throw new Error(\"[squide] Cannot retrieve the Honeycomb instrumentation client from a StorybookRuntime instance.\");\n }\n\n startScope(logger: Logger) {\n return (new StorybookRuntimeScope(this, logger) as unknown) as StorybookRuntime;\n }\n}\n\nexport class StorybookRuntimeScope extends FireflyRuntimeScope { }\n"],"names":["FireflyRuntime","FireflyRuntimeScope","StorybookRuntime","options","honeycombInstrumentationClient","Error","logger","StorybookRuntimeScope"],"mappings":";;;AAA6F;AAItF,MAAME,gBAAgBA,SAASF,cAAcA;IAChD,YAAYG,UAAiC,CAAC,CAAC,CAAE;QAC7C,MAAM,EACFC,8BAA8B,EACjC,GAAGD;QAEJ,IAAIC,gCAAgC;YAChC,MAAM,IAAIC,MAAM;QACpB;QAEA,KAAK,CAACF;IACV;IAEA,gBAAgB;IACZ,yFAAyF;IAC7F;IAEA,IAAI,iCAAwE;QACxE,MAAM,IAAIE,MAAM;IACpB;IAEA,WAAWC,MAAc,EAAE;QACvB,OAAQ,IAAIC,qBAAqBA,CAAC,IAAI,EAAED;IAC5C;AACJ;AAEO,MAAMC,qBAAqBA,SAASN,mBAAmBA;AAAG"}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import { initializeFireflyForStorybook } from "./initializeFireflyForStorybook.js";
|
|
2
|
-
import { StorybookRuntime, StorybookRuntimeScope } from "./StorybookRuntime.js";
|
|
3
|
-
import { withFeatureFlagsOverrideDecorator } from "./withFeatureFlagsOverrideDecorator.js";
|
|
4
|
-
import { FireflyDecorator, withFireflyDecorator } from "./withFireflyDecorator.js";
|
|
5
1
|
|
|
6
|
-
;// CONCATENATED MODULE: external "./initializeFireflyForStorybook.js"
|
|
7
2
|
|
|
8
|
-
;// CONCATENATED MODULE: external "./StorybookRuntime.js"
|
|
9
3
|
|
|
10
|
-
;// CONCATENATED MODULE: external "./withFeatureFlagsOverrideDecorator.js"
|
|
11
4
|
|
|
12
|
-
;// CONCATENATED MODULE: external "./withFireflyDecorator.js"
|
|
13
5
|
|
|
14
|
-
;// CONCATENATED MODULE: ./src/index.ts
|
|
15
6
|
|
|
16
7
|
|
|
17
8
|
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
export {
|
|
10
|
+
export { initializeFireflyForStorybook } from "./initializeFireflyForStorybook.js";
|
|
11
|
+
export { StorybookRuntime, StorybookRuntimeScope } from "./StorybookRuntime.js";
|
|
12
|
+
export { withFeatureFlagsOverrideDecorator } from "./withFeatureFlagsOverrideDecorator.js";
|
|
13
|
+
export { FireflyDecorator, withFireflyDecorator } from "./withFireflyDecorator.js";
|
|
21
14
|
|
|
22
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export { initializeFireflyForStorybook, type InitializeFireflyForStorybookOptions } from \"./initializeFireflyForStorybook.ts\";\nexport { StorybookRuntime, StorybookRuntimeScope } from \"./StorybookRuntime.ts\";\nexport { withFeatureFlagsOverrideDecorator } from \"./withFeatureFlagsOverrideDecorator.tsx\";\nexport { FireflyDecorator, withFireflyDecorator, type FireflyDecoratorProps } from \"./withFireflyDecorator.tsx\";\n\n"],"names":["initializeFireflyForStorybook","StorybookRuntime","StorybookRuntimeScope","withFeatureFlagsOverrideDecorator","FireflyDecorator","withFireflyDecorator"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export { initializeFireflyForStorybook, type InitializeFireflyForStorybookOptions } from \"./initializeFireflyForStorybook.ts\";\nexport { StorybookRuntime, StorybookRuntimeScope } from \"./StorybookRuntime.ts\";\nexport { withFeatureFlagsOverrideDecorator } from \"./withFeatureFlagsOverrideDecorator.tsx\";\nexport { FireflyDecorator, withFireflyDecorator, type FireflyDecoratorProps } from \"./withFireflyDecorator.tsx\";\n\n"],"names":["initializeFireflyForStorybook","StorybookRuntime","StorybookRuntimeScope","withFeatureFlagsOverrideDecorator","FireflyDecorator","withFireflyDecorator"],"mappings":";;;;AAA8H;AAC9C;AACY;AACoB"}
|
|
@@ -3,15 +3,10 @@ import { InMemoryLaunchDarklyClient, LaunchDarklyPlugin, toLocalModuleDefinition
|
|
|
3
3
|
import { MswPlugin } from "@squide/msw";
|
|
4
4
|
import { StorybookRuntime } from "./StorybookRuntime.js";
|
|
5
5
|
|
|
6
|
-
;// CONCATENATED MODULE: external "@squide/env-vars"
|
|
7
6
|
|
|
8
|
-
;// CONCATENATED MODULE: external "@squide/firefly"
|
|
9
7
|
|
|
10
|
-
;// CONCATENATED MODULE: external "@squide/msw"
|
|
11
8
|
|
|
12
|
-
;// CONCATENATED MODULE: external "./StorybookRuntime.js"
|
|
13
9
|
|
|
14
|
-
;// CONCATENATED MODULE: ./src/initializeFireflyForStorybook.ts
|
|
15
10
|
|
|
16
11
|
|
|
17
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeFireflyForStorybook.js","sources":["../src/initializeFireflyForStorybook.ts"],"sourcesContent":["import { EnvironmentVariables, EnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { FireflyRuntime, InMemoryLaunchDarklyClient, LaunchDarklyPlugin, ModuleRegisterFunction, PluginFactory, toLocalModuleDefinitions } from \"@squide/firefly\";\nimport { FeatureFlags } from \"@squide/launch-darkly\";\nimport { MswPlugin } from \"@squide/msw\";\nimport { RootLogger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\nimport { StorybookRuntime } from \"./StorybookRuntime.ts\";\n\nexport interface InitializeFireflyForStorybookOptions {\n localModules?: ModuleRegisterFunction<FireflyRuntime>[];\n environmentVariables?: EnvironmentVariables;\n featureFlags?: Partial<FeatureFlags>;\n launchDarklyClient?: LDClient;\n loggers?: RootLogger[];\n useMsw?: boolean;\n}\n\nfunction logInitializationState(\n runtime: FireflyRuntime,\n options: InitializeFireflyForStorybookOptions,\n plugins: PluginFactory<FireflyRuntime>[]\n) {\n const {\n localModules,\n environmentVariables,\n featureFlags,\n launchDarklyClient,\n useMsw\n } = options;\n const scope = (runtime.logger as RootLogger).startScope(\"[squide] Initializing the application.\");\n\n try {\n scope.information(\"[squide] Mode: development\");\n\n if (localModules) {\n scope\n .withText(\"[squide] Local modules:\")\n .withObject(localModules)\n .information();\n }\n\n scope.information(`[squide] Use MSW: ${useMsw ? \"Yes\" : \"No\"}`);\n\n if (environmentVariables && Object.keys(environmentVariables).length > 0) {\n scope\n .withText(\"[squide] Environment variables:\")\n .withObject(environmentVariables)\n .information();\n }\n\n if (featureFlags) {\n scope\n .withText(\"[squide] Feature flags:\")\n .withObject(featureFlags)\n .information();\n }\n\n if (launchDarklyClient) {\n scope\n .withText(\"[squide] LaunchDarkly client:\")\n .withObject(launchDarklyClient)\n .information();\n }\n\n if (plugins.length > 0) {\n scope\n .withText(\"[squide] Plugins:\")\n .withObject(plugins)\n .information();\n }\n } finally {\n scope.end();\n }\n}\n\nexport async function initializeFireflyForStorybook(options: InitializeFireflyForStorybookOptions = {}) {\n const {\n localModules = [],\n environmentVariables,\n featureFlags = {},\n launchDarklyClient,\n loggers,\n useMsw = true\n } = options;\n\n const plugins: PluginFactory<FireflyRuntime>[] = [\n x => new EnvironmentVariablesPlugin(x, {\n variables: environmentVariables\n }),\n x => new LaunchDarklyPlugin(x, launchDarklyClient ?? new InMemoryLaunchDarklyClient(featureFlags))\n ];\n\n if (useMsw) {\n plugins.push(x => new MswPlugin(x));\n }\n\n const runtime = new StorybookRuntime({\n mode: \"development\",\n plugins,\n loggers\n });\n\n logInitializationState(runtime, options, plugins);\n\n if (localModules.length > 0) {\n await runtime.moduleManager.registerModules([\n ...toLocalModuleDefinitions(localModules)\n ]);\n } else {\n // There's a possibility that either no local modules are provided.\n // This use case is hard to catch at the module manager level because it could also\n // mean that the registration process hasn't started yet.\n // This is safer to handle it here because we got all the modules functions.\n runtime.moduleManager.setAsReady();\n }\n\n return runtime;\n}\n"],"names":["EnvironmentVariablesPlugin","InMemoryLaunchDarklyClient","LaunchDarklyPlugin","toLocalModuleDefinitions","MswPlugin","StorybookRuntime","logInitializationState","runtime","options","plugins","localModules","environmentVariables","featureFlags","launchDarklyClient","useMsw","scope","Object","initializeFireflyForStorybook","loggers","x"],"mappings":"
|
|
1
|
+
{"version":3,"file":"initializeFireflyForStorybook.js","sources":["../src/initializeFireflyForStorybook.ts"],"sourcesContent":["import { EnvironmentVariables, EnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { FireflyRuntime, InMemoryLaunchDarklyClient, LaunchDarklyPlugin, ModuleRegisterFunction, PluginFactory, toLocalModuleDefinitions } from \"@squide/firefly\";\nimport { FeatureFlags } from \"@squide/launch-darkly\";\nimport { MswPlugin } from \"@squide/msw\";\nimport { RootLogger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\nimport { StorybookRuntime } from \"./StorybookRuntime.ts\";\n\nexport interface InitializeFireflyForStorybookOptions {\n localModules?: ModuleRegisterFunction<FireflyRuntime>[];\n environmentVariables?: EnvironmentVariables;\n featureFlags?: Partial<FeatureFlags>;\n launchDarklyClient?: LDClient;\n loggers?: RootLogger[];\n useMsw?: boolean;\n}\n\nfunction logInitializationState(\n runtime: FireflyRuntime,\n options: InitializeFireflyForStorybookOptions,\n plugins: PluginFactory<FireflyRuntime>[]\n) {\n const {\n localModules,\n environmentVariables,\n featureFlags,\n launchDarklyClient,\n useMsw\n } = options;\n const scope = (runtime.logger as RootLogger).startScope(\"[squide] Initializing the application.\");\n\n try {\n scope.information(\"[squide] Mode: development\");\n\n if (localModules) {\n scope\n .withText(\"[squide] Local modules:\")\n .withObject(localModules)\n .information();\n }\n\n scope.information(`[squide] Use MSW: ${useMsw ? \"Yes\" : \"No\"}`);\n\n if (environmentVariables && Object.keys(environmentVariables).length > 0) {\n scope\n .withText(\"[squide] Environment variables:\")\n .withObject(environmentVariables)\n .information();\n }\n\n if (featureFlags) {\n scope\n .withText(\"[squide] Feature flags:\")\n .withObject(featureFlags)\n .information();\n }\n\n if (launchDarklyClient) {\n scope\n .withText(\"[squide] LaunchDarkly client:\")\n .withObject(launchDarklyClient)\n .information();\n }\n\n if (plugins.length > 0) {\n scope\n .withText(\"[squide] Plugins:\")\n .withObject(plugins)\n .information();\n }\n } finally {\n scope.end();\n }\n}\n\nexport async function initializeFireflyForStorybook(options: InitializeFireflyForStorybookOptions = {}) {\n const {\n localModules = [],\n environmentVariables,\n featureFlags = {},\n launchDarklyClient,\n loggers,\n useMsw = true\n } = options;\n\n const plugins: PluginFactory<FireflyRuntime>[] = [\n x => new EnvironmentVariablesPlugin(x, {\n variables: environmentVariables\n }),\n x => new LaunchDarklyPlugin(x, launchDarklyClient ?? new InMemoryLaunchDarklyClient(featureFlags))\n ];\n\n if (useMsw) {\n plugins.push(x => new MswPlugin(x));\n }\n\n const runtime = new StorybookRuntime({\n mode: \"development\",\n plugins,\n loggers\n });\n\n logInitializationState(runtime, options, plugins);\n\n if (localModules.length > 0) {\n await runtime.moduleManager.registerModules([\n ...toLocalModuleDefinitions(localModules)\n ]);\n } else {\n // There's a possibility that either no local modules are provided.\n // This use case is hard to catch at the module manager level because it could also\n // mean that the registration process hasn't started yet.\n // This is safer to handle it here because we got all the modules functions.\n runtime.moduleManager.setAsReady();\n }\n\n return runtime;\n}\n"],"names":["EnvironmentVariablesPlugin","InMemoryLaunchDarklyClient","LaunchDarklyPlugin","toLocalModuleDefinitions","MswPlugin","StorybookRuntime","logInitializationState","runtime","options","plugins","localModules","environmentVariables","featureFlags","launchDarklyClient","useMsw","scope","Object","initializeFireflyForStorybook","loggers","x"],"mappings":";;;;;;;;;AAAoF;AAC8E;AAE1H;AAGiB;AAWzD,SAASM,sBAAsBA,CAC3BC,OAAuB,EACvBC,OAA6C,EAC7CC,OAAwC;IAExC,MAAM,EACFC,YAAY,EACZC,oBAAoB,EACpBC,YAAY,EACZC,kBAAkB,EAClBC,MAAM,EACT,GAAGN;IACJ,MAAMO,QAASR,QAAQ,MAAM,CAAgB,UAAU,CAAC;IAExD,IAAI;QACAQ,MAAM,WAAW,CAAC;QAElB,IAAIL,cAAc;YACdK,MACK,QAAQ,CAAC,2BACT,UAAU,CAACL,cACX,WAAW;QACpB;QAEAK,MAAM,WAAW,CAAC,CAAC,kBAAkB,EAAED,SAAS,QAAQ,MAAM;QAE9D,IAAIH,wBAAwBK,OAAO,IAAI,CAACL,sBAAsB,MAAM,GAAG,GAAG;YACtEI,MACK,QAAQ,CAAC,mCACT,UAAU,CAACJ,sBACX,WAAW;QACpB;QAEA,IAAIC,cAAc;YACdG,MACK,QAAQ,CAAC,2BACT,UAAU,CAACH,cACX,WAAW;QACpB;QAEA,IAAIC,oBAAoB;YACpBE,MACK,QAAQ,CAAC,iCACT,UAAU,CAACF,oBACX,WAAW;QACpB;QAEA,IAAIJ,QAAQ,MAAM,GAAG,GAAG;YACpBM,MACK,QAAQ,CAAC,qBACT,UAAU,CAACN,SACX,WAAW;QACpB;IACJ,SAAU;QACNM,MAAM,GAAG;IACb;AACJ;AAEO,eAAeE,6BAA6BA,CAACT,UAAgD,CAAC,CAAC;IAClG,MAAM,EACFE,eAAe,EAAE,EACjBC,oBAAoB,EACpBC,eAAe,CAAC,CAAC,EACjBC,kBAAkB,EAClBK,OAAO,EACPJ,SAAS,IAAI,EAChB,GAAGN;IAEJ,MAAMC,UAA2C;QAC7CU,CAAAA,IAAK,IAAInB,0BAA0BA,CAACmB,GAAG;gBACnC,WAAWR;YACf;QACAQ,CAAAA,IAAK,IAAIjB,kBAAkBA,CAACiB,GAAGN,sBAAsB,IAAIZ,0BAA0BA,CAACW;KACvF;IAED,IAAIE,QAAQ;QACRL,QAAQ,IAAI,CAACU,CAAAA,IAAK,IAAIf,SAASA,CAACe;IACpC;IAEA,MAAMZ,UAAU,IAAIF,gBAAgBA,CAAC;QACjC,MAAM;QACNI;QACAS;IACJ;IAEAZ,sBAAsBA,CAACC,SAASC,SAASC;IAEzC,IAAIC,aAAa,MAAM,GAAG,GAAG;QACzB,MAAMH,QAAQ,aAAa,CAAC,eAAe,CAAC;eACrCJ,wBAAwBA,CAACO;SAC/B;IACL,OAAO;QACH,mEAAmE;QACnE,mFAAmF;QACnF,yDAAyD;QACzD,4EAA4E;QAC5EH,QAAQ,aAAa,CAAC,UAAU;IACpC;IAEA,OAAOA;AACX"}
|
|
@@ -2,13 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { isEditableLaunchDarklyClient, useLaunchDarklyClient } from "@squide/launch-darkly";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
|
|
5
|
-
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
6
5
|
|
|
7
|
-
;// CONCATENATED MODULE: external "@squide/launch-darkly"
|
|
8
6
|
|
|
9
|
-
;// CONCATENATED MODULE: external "react"
|
|
10
7
|
|
|
11
|
-
;// CONCATENATED MODULE: ./src/withFeatureFlagsOverrideDecorator.tsx
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFeatureFlagsOverrideDecorator.js","sources":["../src/withFeatureFlagsOverrideDecorator.tsx"],"sourcesContent":["import { FeatureFlags, isEditableLaunchDarklyClient, LaunchDarklyClientTransaction, useLaunchDarklyClient } from \"@squide/launch-darkly\";\nimport { PropsWithChildren, useEffect, useRef } from \"react\";\nimport { Decorator } from \"storybook-react-rsbuild\";\n\ninterface OverrideFeatureFlagsProps extends PropsWithChildren {\n overrides: Partial<FeatureFlags>;\n}\n\n// Used to override the flags in a \"useEffect\" hook but then the unit test were not working.\n// To fix the unit tests, the flags are now overrided directly in the render function.\nfunction OverrideFeatureFlags(props: OverrideFeatureFlagsProps) {\n const {\n overrides,\n children\n } = props;\n\n const transactionRef = useRef<LaunchDarklyClientTransaction | undefined>(undefined);\n const client = useLaunchDarklyClient();\n\n // eslint-disable-next-line react-hooks/refs\n if (!transactionRef.current) {\n if (!isEditableLaunchDarklyClient(client)) {\n throw new Error(\"[squide] The withFeatureFlagsOverrideDecorator hook can only be used with an EditableLaunchDarklyClient instance.\");\n }\n\n transactionRef.current = client.startTransaction();\n client.setFeatureFlags(overrides);\n }\n\n useEffect(() => {\n return () => {\n // Reset the feature flags to the original values.\n transactionRef.current?.undo();\n transactionRef.current = undefined;\n };\n }, [transactionRef]);\n\n return children;\n}\n\nexport function withFeatureFlagsOverrideDecorator(overrides: Partial<FeatureFlags>): Decorator {\n return story => {\n return (\n <OverrideFeatureFlags overrides={overrides}>\n {story()}\n </OverrideFeatureFlags>\n );\n };\n}\n"],"names":["isEditableLaunchDarklyClient","useLaunchDarklyClient","useEffect","useRef","OverrideFeatureFlags","props","overrides","children","transactionRef","undefined","client","Error","withFeatureFlagsOverrideDecorator","story"],"mappings":"
|
|
1
|
+
{"version":3,"file":"withFeatureFlagsOverrideDecorator.js","sources":["../src/withFeatureFlagsOverrideDecorator.tsx"],"sourcesContent":["import { FeatureFlags, isEditableLaunchDarklyClient, LaunchDarklyClientTransaction, useLaunchDarklyClient } from \"@squide/launch-darkly\";\nimport { PropsWithChildren, useEffect, useRef } from \"react\";\nimport { Decorator } from \"storybook-react-rsbuild\";\n\ninterface OverrideFeatureFlagsProps extends PropsWithChildren {\n overrides: Partial<FeatureFlags>;\n}\n\n// Used to override the flags in a \"useEffect\" hook but then the unit test were not working.\n// To fix the unit tests, the flags are now overrided directly in the render function.\nfunction OverrideFeatureFlags(props: OverrideFeatureFlagsProps) {\n const {\n overrides,\n children\n } = props;\n\n const transactionRef = useRef<LaunchDarklyClientTransaction | undefined>(undefined);\n const client = useLaunchDarklyClient();\n\n // eslint-disable-next-line react-hooks/refs\n if (!transactionRef.current) {\n if (!isEditableLaunchDarklyClient(client)) {\n throw new Error(\"[squide] The withFeatureFlagsOverrideDecorator hook can only be used with an EditableLaunchDarklyClient instance.\");\n }\n\n transactionRef.current = client.startTransaction();\n client.setFeatureFlags(overrides);\n }\n\n useEffect(() => {\n return () => {\n // Reset the feature flags to the original values.\n transactionRef.current?.undo();\n transactionRef.current = undefined;\n };\n }, [transactionRef]);\n\n return children;\n}\n\nexport function withFeatureFlagsOverrideDecorator(overrides: Partial<FeatureFlags>): Decorator {\n return story => {\n return (\n <OverrideFeatureFlags overrides={overrides}>\n {story()}\n </OverrideFeatureFlags>\n );\n };\n}\n"],"names":["isEditableLaunchDarklyClient","useLaunchDarklyClient","useEffect","useRef","OverrideFeatureFlags","props","overrides","children","transactionRef","undefined","client","Error","withFeatureFlagsOverrideDecorator","story"],"mappings":";;;;;;;;AAAyI;AAC5E;AAO7D,4FAA4F;AAC5F,sFAAsF;AACtF,SAASI,oBAAoBA,CAACC,KAAgC;IAC1D,MAAM,EACFC,SAAS,EACTC,QAAQ,EACX,GAAGF;IAEJ,MAAMG,iBAAiBL,MAAMA,CAA4CM;IACzE,MAAMC,SAAST,qBAAqBA;IAEpC,4CAA4C;IAC5C,IAAI,CAACO,eAAe,OAAO,EAAE;QACzB,IAAI,CAACR,4BAA4BA,CAACU,SAAS;YACvC,MAAM,IAAIC,MAAM;QACpB;QAEAH,eAAe,OAAO,GAAGE,OAAO,gBAAgB;QAChDA,OAAO,eAAe,CAACJ;IAC3B;IAEAJ,SAASA,CAAC;QACN,OAAO;YACH,kDAAkD;YAClDM,eAAe,OAAO,EAAE;YACxBA,eAAe,OAAO,GAAGC;QAC7B;IACJ,GAAG;QAACD;KAAe;IAEnB,OAAOD;AACX;AAEO,SAASK,iCAAiCA,CAACN,SAAgC;IAC9E,OAAOO,CAAAA;QACH,qBACI,IAACT,oBAAoBA;YAAC,WAAWE;sBAC5BO;;IAGb;AACJ"}
|
|
@@ -3,15 +3,10 @@ import { AppRouter, FireflyProvider } from "@squide/firefly";
|
|
|
3
3
|
import { createMemoryRouter } from "react-router";
|
|
4
4
|
import { RouterProvider } from "react-router/dom";
|
|
5
5
|
|
|
6
|
-
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
7
6
|
|
|
8
|
-
;// CONCATENATED MODULE: external "@squide/firefly"
|
|
9
7
|
|
|
10
|
-
;// CONCATENATED MODULE: external "react-router"
|
|
11
8
|
|
|
12
|
-
;// CONCATENATED MODULE: external "react-router/dom"
|
|
13
9
|
|
|
14
|
-
;// CONCATENATED MODULE: ./src/withFireflyDecorator.tsx
|
|
15
10
|
|
|
16
11
|
|
|
17
12
|
|
|
@@ -30,7 +25,7 @@ function FireflyDecorator(props) {
|
|
|
30
25
|
runtime: runtime,
|
|
31
26
|
children: /*#__PURE__*/ jsx(AppRouter, {
|
|
32
27
|
strictMode: false,
|
|
33
|
-
children: ({ rootRoute, routerProviderProps })=>{
|
|
28
|
+
children: ({ rootRoute, routerProps, routerProviderProps })=>{
|
|
34
29
|
return /*#__PURE__*/ jsx(RouterProvider, {
|
|
35
30
|
router: createMemoryRouter([
|
|
36
31
|
{
|
|
@@ -43,6 +38,7 @@ function FireflyDecorator(props) {
|
|
|
43
38
|
]
|
|
44
39
|
}
|
|
45
40
|
], {
|
|
41
|
+
...routerProps,
|
|
46
42
|
initialEntries: [
|
|
47
43
|
"/story"
|
|
48
44
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFireflyDecorator.js","sources":["../src/withFireflyDecorator.tsx"],"sourcesContent":["import { AppRouter, FireflyProvider, FireflyRuntime } from \"@squide/firefly\";\nimport type { PropsWithChildren } from \"react\";\nimport { createMemoryRouter } from \"react-router\";\nimport { RouterProvider } from \"react-router/dom\";\nimport { Decorator } from \"storybook-react-rsbuild\";\n\nexport function withFireflyDecorator(runtime: FireflyRuntime): Decorator {\n return story => {\n return (\n <FireflyDecorator runtime={runtime}>\n {story()}\n </FireflyDecorator>\n );\n };\n}\n\nexport interface FireflyDecoratorProps extends PropsWithChildren {\n runtime: FireflyRuntime;\n}\n\nexport function FireflyDecorator(props: FireflyDecoratorProps) {\n const {\n runtime,\n children: story\n } = props;\n\n return (\n <FireflyProvider runtime={runtime}>\n <AppRouter strictMode={false}>\n {({ rootRoute, routerProviderProps }) => {\n return (\n <RouterProvider\n router={createMemoryRouter([\n {\n element: rootRoute,\n children: [\n {\n path: \"/story\",\n element: story\n }\n ]\n }\n ], {\n initialEntries: [\"/story\"]\n })}\n {...routerProviderProps}\n />\n );\n }}\n </AppRouter>\n </FireflyProvider>\n );\n}\n"],"names":["AppRouter","FireflyProvider","createMemoryRouter","RouterProvider","withFireflyDecorator","runtime","story","FireflyDecorator","props","rootRoute","routerProviderProps"],"mappings":"
|
|
1
|
+
{"version":3,"file":"withFireflyDecorator.js","sources":["../src/withFireflyDecorator.tsx"],"sourcesContent":["import { AppRouter, FireflyProvider, FireflyRuntime } from \"@squide/firefly\";\nimport type { PropsWithChildren } from \"react\";\nimport { createMemoryRouter } from \"react-router\";\nimport { RouterProvider } from \"react-router/dom\";\nimport { Decorator } from \"storybook-react-rsbuild\";\n\nexport function withFireflyDecorator(runtime: FireflyRuntime): Decorator {\n return story => {\n return (\n <FireflyDecorator runtime={runtime}>\n {story()}\n </FireflyDecorator>\n );\n };\n}\n\nexport interface FireflyDecoratorProps extends PropsWithChildren {\n runtime: FireflyRuntime;\n}\n\nexport function FireflyDecorator(props: FireflyDecoratorProps) {\n const {\n runtime,\n children: story\n } = props;\n\n return (\n <FireflyProvider runtime={runtime}>\n <AppRouter strictMode={false}>\n {({ rootRoute, routerProps, routerProviderProps }) => {\n return (\n <RouterProvider\n router={createMemoryRouter([\n {\n element: rootRoute,\n children: [\n {\n path: \"/story\",\n element: story\n }\n ]\n }\n ], {\n ...routerProps,\n initialEntries: [\"/story\"]\n })}\n {...routerProviderProps}\n />\n );\n }}\n </AppRouter>\n </FireflyProvider>\n );\n}\n"],"names":["AppRouter","FireflyProvider","createMemoryRouter","RouterProvider","withFireflyDecorator","runtime","story","FireflyDecorator","props","rootRoute","routerProps","routerProviderProps"],"mappings":";;;;;;;;;;AAA6E;AAE3B;AACA;AAG3C,SAASI,oBAAoBA,CAACC,OAAuB;IACxD,OAAOC,CAAAA;QACH,qBACI,IAACC,gBAAgBA;YAAC,SAASF;sBACtBC;;IAGb;AACJ;AAMO,SAASC,gBAAgBA,CAACC,KAA4B;IACzD,MAAM,EACFH,OAAO,EACP,UAAUC,KAAK,EAClB,GAAGE;IAEJ,qBACI,IAACP,eAAeA;QAAC,SAASI;kBACtB,kBAACL,SAASA;YAAC,YAAY;sBAClB,CAAC,EAAES,SAAS,EAAEC,WAAW,EAAEC,mBAAmB,EAAE;gBAC7C,qBACI,IAACR,cAAcA;oBACX,QAAQD,kBAAkBA,CAAC;wBACvB;4BACI,SAASO;4BACT,UAAU;gCACN;oCACI,MAAM;oCACN,SAASH;gCACb;6BACH;wBACL;qBACH,EAAE;wBACC,GAAGI,WAAW;wBACd,gBAAgB;4BAAC;yBAAS;oBAC9B;oBACC,GAAGC,mBAAmB;;YAGnC;;;AAIhB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly-rsbuild-storybook",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"description": "Squide firefly helpers for Storybook and Rsbuild.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"CHANGELOG.md"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@opentelemetry/api": "^1.9.
|
|
31
|
-
"@rsbuild/core": "^1.7.
|
|
32
|
-
"@tanstack/react-query": "^5.
|
|
30
|
+
"@opentelemetry/api": "^1.9.1",
|
|
31
|
+
"@rsbuild/core": "^1.7.5",
|
|
32
|
+
"@tanstack/react-query": "^5.96.0",
|
|
33
33
|
"launchdarkly-js-client-sdk": "^3.9.0",
|
|
34
|
-
"msw": "^2.12.
|
|
34
|
+
"msw": "^2.12.14",
|
|
35
35
|
"react": "^18.0.0 || ^19.0.0",
|
|
36
36
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
37
|
-
"react-router": "^7.13.
|
|
38
|
-
"storybook": "^10.
|
|
39
|
-
"storybook-react-rsbuild": "^3.3.
|
|
37
|
+
"react-router": "^7.13.2",
|
|
38
|
+
"storybook": "^10.3.3",
|
|
39
|
+
"storybook-react-rsbuild": "^3.3.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@opentelemetry/api": {
|
|
@@ -44,31 +44,32 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@workleap-telemetry/core": "^2.0.
|
|
48
|
-
"@workleap/logging": "^1.3.
|
|
49
|
-
"@squide/
|
|
50
|
-
"@squide/
|
|
51
|
-
"@squide/launch-darkly": "^1.0.
|
|
52
|
-
"@squide/msw": "^4.0.
|
|
47
|
+
"@workleap-telemetry/core": "^2.0.1",
|
|
48
|
+
"@workleap/logging": "^1.3.7",
|
|
49
|
+
"@squide/env-vars": "^1.4.20",
|
|
50
|
+
"@squide/firefly": "^16.2.2",
|
|
51
|
+
"@squide/launch-darkly": "^1.0.11",
|
|
52
|
+
"@squide/msw": "^4.0.18"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@eslint/js": "9.39.2",
|
|
56
|
-
"@rsbuild/core": "1.7.
|
|
57
|
-
"@rslib/core": "0.
|
|
56
|
+
"@rsbuild/core": "1.7.5",
|
|
57
|
+
"@rslib/core": "0.20.2",
|
|
58
58
|
"@testing-library/react": "16.3.2",
|
|
59
|
+
"@types/node": "25.5.0",
|
|
59
60
|
"@types/react": "19.2.14",
|
|
60
61
|
"@types/react-dom": "19.2.3",
|
|
61
|
-
"@typescript-eslint/parser": "8.
|
|
62
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
63
|
-
"@vitejs/plugin-react": "
|
|
64
|
-
"@workleap/eslint-configs": "
|
|
65
|
-
"@workleap/rslib-configs": "1.1.
|
|
66
|
-
"@workleap/typescript-configs": "
|
|
62
|
+
"@typescript-eslint/parser": "8.58.0",
|
|
63
|
+
"@typescript/native-preview": "7.0.0-dev.20260331.1",
|
|
64
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
65
|
+
"@workleap/eslint-configs": "2.0.1",
|
|
66
|
+
"@workleap/rslib-configs": "1.1.11",
|
|
67
|
+
"@workleap/typescript-configs": "4.0.0",
|
|
67
68
|
"eslint": "9.39.2",
|
|
68
|
-
"happy-dom": "20.8.
|
|
69
|
-
"typescript": "
|
|
69
|
+
"happy-dom": "20.8.9",
|
|
70
|
+
"typescript": "6.0.2",
|
|
70
71
|
"typescript-eslint": "8.54.0",
|
|
71
|
-
"vitest": "4.
|
|
72
|
+
"vitest": "4.1.2"
|
|
72
73
|
},
|
|
73
74
|
"sideEffects": false,
|
|
74
75
|
"scripts": {
|
|
@@ -27,7 +27,7 @@ export function FireflyDecorator(props: FireflyDecoratorProps) {
|
|
|
27
27
|
return (
|
|
28
28
|
<FireflyProvider runtime={runtime}>
|
|
29
29
|
<AppRouter strictMode={false}>
|
|
30
|
-
{({ rootRoute, routerProviderProps }) => {
|
|
30
|
+
{({ rootRoute, routerProps, routerProviderProps }) => {
|
|
31
31
|
return (
|
|
32
32
|
<RouterProvider
|
|
33
33
|
router={createMemoryRouter([
|
|
@@ -41,6 +41,7 @@ export function FireflyDecorator(props: FireflyDecoratorProps) {
|
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
], {
|
|
44
|
+
...routerProps,
|
|
44
45
|
initialEntries: ["/story"]
|
|
45
46
|
})}
|
|
46
47
|
{...routerProviderProps}
|