@powerlines/plugin-open-feature 0.1.32 → 0.1.34

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.
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
4
  let _alloy_js_core = require("@alloy-js/core");
4
5
  let _alloy_js_typescript = require("@alloy-js/typescript");
5
6
  let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
@@ -7,7 +8,6 @@ let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powe
7
8
  let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
8
9
  let defu = require("defu");
9
10
  defu = require_runtime.__toESM(defu);
10
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
11
11
 
12
12
  //#region src/components/features-builtin.tsx
13
13
  /**
@@ -15,79 +15,87 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
15
15
  */
16
16
  function FeaturesBuiltin(props) {
17
17
  const [{ children, imports }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "imports"]);
18
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, {
18
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
19
19
  id: "features",
20
- description: "The runtime feature flags module provides an interface to define environment configuration parameters.",
21
- ...rest,
22
- imports: (0, defu.default)({ "@openfeature/server-sdk": [
23
- { name: "OpenFeature" },
24
- {
25
- name: "Provider",
26
- type: true
27
- },
28
- {
29
- name: "ProviderWrapper",
30
- type: true
31
- },
32
- {
33
- name: "ServerProviderStatus",
34
- type: true
35
- }
36
- ] }, imports ?? {}),
37
- children: [
38
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
39
- heading: "A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.",
40
- children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
41
- name: "provider",
42
- children: `The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`
43
- })
44
- }),
45
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
46
- name: "setFeatureProvider",
47
- export: true,
48
- async: true,
49
- parameters: [{
50
- name: "provider",
51
- type: "ProviderWrapper<Provider, ServerProviderStatus>"
52
- }],
53
- children: _alloy_js_core.code`try {
20
+ description: "The runtime feature flags module provides an interface to define environment configuration parameters."
21
+ }, rest, {
22
+ get imports() {
23
+ return (0, defu.default)({ "@openfeature/server-sdk": [
24
+ { name: "OpenFeature" },
25
+ {
26
+ name: "Provider",
27
+ type: true
28
+ },
29
+ {
30
+ name: "ProviderWrapper",
31
+ type: true
32
+ },
33
+ {
34
+ name: "ServerProviderStatus",
35
+ type: true
36
+ }
37
+ ] }, imports ?? {});
38
+ },
39
+ get children() {
40
+ return [
41
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
42
+ heading: "A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.",
43
+ get children() {
44
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
45
+ name: "provider",
46
+ children: `The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`
47
+ });
48
+ }
49
+ }),
50
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
51
+ name: "setFeatureProvider",
52
+ "export": true,
53
+ async: true,
54
+ parameters: [{
55
+ name: "provider",
56
+ type: "ProviderWrapper<Provider, ServerProviderStatus>"
57
+ }],
58
+ children: _alloy_js_core.code`try {
54
59
  await OpenFeature.setProviderAndWait(provider);
55
60
  } catch (error) {
56
61
  console.error("Failed to initialize provider: ", error);
57
62
  } `
58
- }),
59
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
60
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
61
- name: "client",
62
- export: true,
63
- const: true,
64
- doc: "The Open Feature runtime client to provide feature flag evaluations.",
65
- type: "ReturnType<typeof OpenFeature.getClient>",
66
- children: _alloy_js_core.code`OpenFeature.getClient(); `
67
- }),
68
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
69
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
70
- name: "feature",
71
- export: true,
72
- async: true,
73
- parameters: [{
74
- name: "featureId",
75
- type: "string"
76
- }],
77
- returnType: "Promise<boolean>",
78
- children: _alloy_js_core.code`try {
63
+ }),
64
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
65
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
66
+ name: "client",
67
+ "export": true,
68
+ "const": true,
69
+ doc: "The Open Feature runtime client to provide feature flag evaluations.",
70
+ type: "ReturnType<typeof OpenFeature.getClient>",
71
+ children: _alloy_js_core.code`OpenFeature.getClient(); `
72
+ }),
73
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
74
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
75
+ name: "feature",
76
+ "export": true,
77
+ async: true,
78
+ parameters: [{
79
+ name: "featureId",
80
+ type: "string"
81
+ }],
82
+ returnType: "Promise<boolean>",
83
+ children: _alloy_js_core.code`try {
79
84
  return client.getBooleanValue(featureId);
80
85
  } catch (error) {
81
86
  console.error("Failed to evaluate feature flag: ", error);
82
87
  } `
83
- }),
84
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
85
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
86
- when: Boolean(children),
87
- children
88
- })
89
- ]
90
- });
88
+ }),
89
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
90
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
91
+ get when() {
92
+ return Boolean(children);
93
+ },
94
+ children
95
+ })
96
+ ];
97
+ }
98
+ }));
91
99
  }
92
100
 
93
101
  //#endregion
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
2
 
4
3
  //#region src/components/features-builtin.d.ts
@@ -6,7 +5,7 @@ type FeaturesBuiltinProps = Omit<BuiltinFileProps, "id">;
6
5
  /**
7
6
  * Generates the feature flags module for the Powerlines project.
8
7
  */
9
- declare function FeaturesBuiltin(props: FeaturesBuiltinProps): _$_alloy_js_core0.Children;
8
+ declare function FeaturesBuiltin(props: FeaturesBuiltinProps): any;
10
9
  //#endregion
11
10
  export { FeaturesBuiltin, FeaturesBuiltinProps };
12
11
  //# sourceMappingURL=features-builtin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"features-builtin.d.cts","names":[],"sources":["../../src/components/features-builtin.tsx"],"mappings":";;;;KA+BY,oBAAA,GAAuB,IAAA,CAAK,gBAAA;;;AAAxC;iBAKgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"features-builtin.d.cts","names":[],"sources":["../../src/components/features-builtin.tsx"],"mappings":";;;KA+BY,oBAAA,GAAuB,IAAA,CAAK,gBAAA;;AAAxC;;iBAKgB,eAAA,CAAgB,KAAA,EAAO,oBAAA"}
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
2
 
4
3
  //#region src/components/features-builtin.d.ts
@@ -6,7 +5,7 @@ type FeaturesBuiltinProps = Omit<BuiltinFileProps, "id">;
6
5
  /**
7
6
  * Generates the feature flags module for the Powerlines project.
8
7
  */
9
- declare function FeaturesBuiltin(props: FeaturesBuiltinProps): _$_alloy_js_core0.Children;
8
+ declare function FeaturesBuiltin(props: FeaturesBuiltinProps): any;
10
9
  //#endregion
11
10
  export { FeaturesBuiltin, FeaturesBuiltinProps };
12
11
  //# sourceMappingURL=features-builtin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"features-builtin.d.mts","names":[],"sources":["../../src/components/features-builtin.tsx"],"mappings":";;;;KA+BY,oBAAA,GAAuB,IAAA,CAAK,gBAAA;;;AAAxC;iBAKgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"features-builtin.d.mts","names":[],"sources":["../../src/components/features-builtin.tsx"],"mappings":";;;KA+BY,oBAAA,GAAuB,IAAA,CAAK,gBAAA;;AAAxC;;iBAKgB,eAAA,CAAgB,KAAA,EAAO,oBAAA"}
@@ -1,10 +1,10 @@
1
+ import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
1
2
  import { Show, code, splitProps } from "@alloy-js/core";
2
3
  import { FunctionDeclaration, VarDeclaration } from "@alloy-js/typescript";
3
4
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
4
5
  import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
5
6
  import { TSDoc, TSDocParam } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
6
7
  import defu from "defu";
7
- import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
8
8
 
9
9
  //#region src/components/features-builtin.tsx
10
10
  /**
@@ -12,79 +12,87 @@ import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
12
12
  */
13
13
  function FeaturesBuiltin(props) {
14
14
  const [{ children, imports }, rest] = splitProps(props, ["children", "imports"]);
15
- return /* @__PURE__ */ jsxs(BuiltinFile, {
15
+ return createComponent(BuiltinFile, mergeProps({
16
16
  id: "features",
17
- description: "The runtime feature flags module provides an interface to define environment configuration parameters.",
18
- ...rest,
19
- imports: defu({ "@openfeature/server-sdk": [
20
- { name: "OpenFeature" },
21
- {
22
- name: "Provider",
23
- type: true
24
- },
25
- {
26
- name: "ProviderWrapper",
27
- type: true
28
- },
29
- {
30
- name: "ServerProviderStatus",
31
- type: true
32
- }
33
- ] }, imports ?? {}),
34
- children: [
35
- /* @__PURE__ */ jsx(TSDoc, {
36
- heading: "A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.",
37
- children: /* @__PURE__ */ jsx(TSDocParam, {
38
- name: "provider",
39
- children: `The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`
40
- })
41
- }),
42
- /* @__PURE__ */ jsx(FunctionDeclaration, {
43
- name: "setFeatureProvider",
44
- export: true,
45
- async: true,
46
- parameters: [{
47
- name: "provider",
48
- type: "ProviderWrapper<Provider, ServerProviderStatus>"
49
- }],
50
- children: code`try {
17
+ description: "The runtime feature flags module provides an interface to define environment configuration parameters."
18
+ }, rest, {
19
+ get imports() {
20
+ return defu({ "@openfeature/server-sdk": [
21
+ { name: "OpenFeature" },
22
+ {
23
+ name: "Provider",
24
+ type: true
25
+ },
26
+ {
27
+ name: "ProviderWrapper",
28
+ type: true
29
+ },
30
+ {
31
+ name: "ServerProviderStatus",
32
+ type: true
33
+ }
34
+ ] }, imports ?? {});
35
+ },
36
+ get children() {
37
+ return [
38
+ createComponent(TSDoc, {
39
+ heading: "A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.",
40
+ get children() {
41
+ return createComponent(TSDocParam, {
42
+ name: "provider",
43
+ children: `The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`
44
+ });
45
+ }
46
+ }),
47
+ createComponent(FunctionDeclaration, {
48
+ name: "setFeatureProvider",
49
+ "export": true,
50
+ async: true,
51
+ parameters: [{
52
+ name: "provider",
53
+ type: "ProviderWrapper<Provider, ServerProviderStatus>"
54
+ }],
55
+ children: code`try {
51
56
  await OpenFeature.setProviderAndWait(provider);
52
57
  } catch (error) {
53
58
  console.error("Failed to initialize provider: ", error);
54
59
  } `
55
- }),
56
- /* @__PURE__ */ jsx(Spacing, {}),
57
- /* @__PURE__ */ jsx(VarDeclaration, {
58
- name: "client",
59
- export: true,
60
- const: true,
61
- doc: "The Open Feature runtime client to provide feature flag evaluations.",
62
- type: "ReturnType<typeof OpenFeature.getClient>",
63
- children: code`OpenFeature.getClient(); `
64
- }),
65
- /* @__PURE__ */ jsx(Spacing, {}),
66
- /* @__PURE__ */ jsx(FunctionDeclaration, {
67
- name: "feature",
68
- export: true,
69
- async: true,
70
- parameters: [{
71
- name: "featureId",
72
- type: "string"
73
- }],
74
- returnType: "Promise<boolean>",
75
- children: code`try {
60
+ }),
61
+ createComponent(Spacing, {}),
62
+ createComponent(VarDeclaration, {
63
+ name: "client",
64
+ "export": true,
65
+ "const": true,
66
+ doc: "The Open Feature runtime client to provide feature flag evaluations.",
67
+ type: "ReturnType<typeof OpenFeature.getClient>",
68
+ children: code`OpenFeature.getClient(); `
69
+ }),
70
+ createComponent(Spacing, {}),
71
+ createComponent(FunctionDeclaration, {
72
+ name: "feature",
73
+ "export": true,
74
+ async: true,
75
+ parameters: [{
76
+ name: "featureId",
77
+ type: "string"
78
+ }],
79
+ returnType: "Promise<boolean>",
80
+ children: code`try {
76
81
  return client.getBooleanValue(featureId);
77
82
  } catch (error) {
78
83
  console.error("Failed to evaluate feature flag: ", error);
79
84
  } `
80
- }),
81
- /* @__PURE__ */ jsx(Spacing, {}),
82
- /* @__PURE__ */ jsx(Show, {
83
- when: Boolean(children),
84
- children
85
- })
86
- ]
87
- });
85
+ }),
86
+ createComponent(Spacing, {}),
87
+ createComponent(Show, {
88
+ get when() {
89
+ return Boolean(children);
90
+ },
91
+ children
92
+ })
93
+ ];
94
+ }
95
+ }));
88
96
  }
89
97
 
90
98
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"features-builtin.mjs","names":[],"sources":["../../src/components/features-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration, VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport type FeaturesBuiltinProps = Omit<BuiltinFileProps, \"id\">;\n\n/**\n * Generates the feature flags module for the Powerlines project.\n */\nexport function FeaturesBuiltin(props: FeaturesBuiltinProps) {\n const [{ children, imports }, rest] = splitProps(props, [\n \"children\",\n \"imports\"\n ]);\n\n // const context = usePowerlines<OpenFeaturePluginContext>();\n\n return (\n <BuiltinFile\n id=\"features\"\n description=\"The runtime feature flags module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@openfeature/server-sdk\": [\n { name: \"OpenFeature\" },\n { name: \"Provider\", type: true },\n { name: \"ProviderWrapper\", type: true },\n { name: \"ServerProviderStatus\", type: true }\n ]\n },\n imports ?? {}\n )}>\n <TSDoc heading=\"A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.\">\n <TSDocParam name=\"provider\">\n {`The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n name=\"setFeatureProvider\"\n export\n async\n parameters={[\n {\n name: \"provider\",\n type: \"ProviderWrapper<Provider, ServerProviderStatus>\"\n }\n ]}>\n {code`try {\n await OpenFeature.setProviderAndWait(provider);\n } catch (error) {\n console.error(\"Failed to initialize provider: \", error);\n } `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n name=\"client\"\n export\n const\n doc=\"The Open Feature runtime client to provide feature flag evaluations.\"\n type=\"ReturnType<typeof OpenFeature.getClient>\">\n {code`OpenFeature.getClient(); `}\n </VarDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"feature\"\n export\n async\n parameters={[\n {\n name: \"featureId\",\n type: \"string\"\n }\n ]}\n returnType=\"Promise<boolean>\">\n {code`try {\n return client.getBooleanValue(featureId);\n } catch (error) {\n console.error(\"Failed to evaluate feature flag: \", error);\n } `}\n </FunctionDeclaration>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAoCA,SAAgB,gBAAgB,OAA6B;CAC3D,MAAM,CAAC,EAAE,UAAU,WAAW,QAAQ,WAAW,OAAO,CACtD,YACA,UACD,CAAC;AAIF,QACE,qBAAC,aAAD;EACE,IAAG;EACH,aAAY;EACZ,GAAI;EACJ,SAAS,KACP,EACE,2BAA2B;GACzB,EAAE,MAAM,eAAe;GACvB;IAAE,MAAM;IAAY,MAAM;IAAM;GAChC;IAAE,MAAM;IAAmB,MAAM;IAAM;GACvC;IAAE,MAAM;IAAwB,MAAM;IAAM;GAC7C,EACF,EACD,WAAW,EAAE,CACd;YAdH;GAeE,oBAAC,OAAD;IAAO,SAAQ;cACb,oBAAC,YAAD;KAAY,MAAK;eACd;KACU;IACP;GACR,oBAAC,qBAAD;IACE,MAAK;IACL;IACA;IACA,YAAY,CACV;KACE,MAAM;KACN,MAAM;KACP,CACF;cACA,IAAI;;;;;IAKe;GACtB,oBAAC,SAAD,EAAW;GACX,oBAAC,gBAAD;IACE,MAAK;IACL;IACA;IACA,KAAI;IACJ,MAAK;cACJ,IAAI;IACU;GACjB,oBAAC,SAAD,EAAW;GACX,oBAAC,qBAAD;IACE,MAAK;IACL;IACA;IACA,YAAY,CACV;KACE,MAAM;KACN,MAAM;KACP,CACF;IACD,YAAW;cACV,IAAI;;;;;IAKe;GACtB,oBAAC,SAAD,EAAW;GACX,oBAAC,MAAD;IAAM,MAAM,QAAQ,SAAS;IAAG;IAAgB;GACpC"}
1
+ {"version":3,"file":"features-builtin.mjs","names":[],"sources":["../../src/components/features-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport { FunctionDeclaration, VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocParam\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport type FeaturesBuiltinProps = Omit<BuiltinFileProps, \"id\">;\n\n/**\n * Generates the feature flags module for the Powerlines project.\n */\nexport function FeaturesBuiltin(props: FeaturesBuiltinProps) {\n const [{ children, imports }, rest] = splitProps(props, [\n \"children\",\n \"imports\"\n ]);\n\n // const context = usePowerlines<OpenFeaturePluginContext>();\n\n return (\n <BuiltinFile\n id=\"features\"\n description=\"The runtime feature flags module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@openfeature/server-sdk\": [\n { name: \"OpenFeature\" },\n { name: \"Provider\", type: true },\n { name: \"ProviderWrapper\", type: true },\n { name: \"ServerProviderStatus\", type: true }\n ]\n },\n imports ?? {}\n )}>\n <TSDoc heading=\"A function to set the OpenFeature providers to be used in the application. This function should be called at the entry point of the application to ensure that the providers are registered before any feature flag evaluations occur.\">\n <TSDocParam name=\"provider\">\n {`The provider wrapper containing the OpenFeature provider to set. The provider should be an instance of a class that implements the OpenFeature Provider interface, wrapped in a ProviderWrapper to include any necessary metadata about the provider's status.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n name=\"setFeatureProvider\"\n export\n async\n parameters={[\n {\n name: \"provider\",\n type: \"ProviderWrapper<Provider, ServerProviderStatus>\"\n }\n ]}>\n {code`try {\n await OpenFeature.setProviderAndWait(provider);\n } catch (error) {\n console.error(\"Failed to initialize provider: \", error);\n } `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n name=\"client\"\n export\n const\n doc=\"The Open Feature runtime client to provide feature flag evaluations.\"\n type=\"ReturnType<typeof OpenFeature.getClient>\">\n {code`OpenFeature.getClient(); `}\n </VarDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"feature\"\n export\n async\n parameters={[\n {\n name: \"featureId\",\n type: \"string\"\n }\n ]}\n returnType=\"Promise<boolean>\">\n {code`try {\n return client.getBooleanValue(featureId);\n } catch (error) {\n console.error(\"Failed to evaluate feature flag: \", error);\n } `}\n </FunctionDeclaration>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,SAAS,gBAAuB,OAAC;CACjC,MAAO,CAAA,YAEP;AAKA,QAAO,gBAAS,aAAuB,WAAA;EACrC,IAAM;EACJ,aAAU;EACX,EAAE,MAAA;EACD,IAAA,UAAA;iBAEC,2BAA8B;IAAA,uBAE1B;IAAA;KACJ,MAAA;KACK,MAAA;KACJ;IAAA;KACI,MAAI;KACR,MAAS;KACP;IAAA;KACE,MAAE;KACF,MAAI;KACL;IAAC,EACH,EAAE,WAAW,EAAC,CAAA;;EAEjB,IAAI,WAAE;AACJ,UAAG;IAAA,gBAAA,OAAA;KACD,SAAS;KACT,IAAA,WAAA;AACD,aAAM,gBAAsB,YAAS;OACnC,MAAA;OACG,UAAI;OACN,CAAA;;KAEH,CAAA;IAAA,gBAAA,qBAAA;KACC,MAAM;KACN,UAAA;KACA,OAAA;KACA,YAAY,CAAA;MACV,MAAA;MACA,MAAM;MACP,CAAC;KACF,UAAE,IAAA;;;;;KAKH,CAAC;IAAE,gBAAe,SAAU,EAAA,CAAA;IAAA,gBAAwB,gBAAM;KACzD,MAAG;KACH,UAAA;KACD,SAAS;KACT,KAAA;KACC,MAAM;KACN,UAAA,IAAA;KACD,CAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,qBAAA;KACA,MAAK;KACL,UAAM;KACN,OAAM;KACN,YAAA,CAAA;MACD,MAAS;MACT,MAAA;MACC,CAAA;KACA,YAAA;KACA,UAAA,IAAA;;;;;KAKD,CAAC;IAAE,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KACF,IAAC,OAAA;AACD,aAAA,QAAY,SAAQ;;KAEX;KACV,CAAC;IAAC;;EAEN,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate feature flags documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const features = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"features\",\n async generate() {\n const featuresDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"features.md\"\n );\n\n if (!context.fs.existsSync(featuresDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(featuresDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,YAAY,YACvB,gBAAgB;CACd,MAAM;CACN,MAAM,WAAW;EACf,MAAM,kBAAkB,UACtB,QAAQ,OAAO,MACf,QACA,aACA,cACD;AAED,MAAI,CAAC,QAAQ,GAAG,WAAW,gBAAgB,CACzC,QAAO,EACL,UAAU,IACX;AAKH,SAAO,EACL,UAHe,MAAM,QAAQ,GAAG,KAAK,gBAAgB,IAG/B,IACvB;;CAEJ,CAAC"}
1
+ {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate feature flags documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const features = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"features\",\n async generate() {\n const featuresDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"features.md\"\n );\n\n if (!context.fs.existsSync(featuresDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(featuresDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,YAAW,YAAU,gBAAiB;CACjD,MAAA;CACA,MAAM,WAAW;EACf,MAAM,kBAAW,UAAA,QAAA,OAAA,MAAA,QAAA,aAAA,cAAA;AACjB,MAAE,CAAA,QAAM,GAAA,WAAkB,gBAAS,CACjC,QAAE,EACA,UAAM,IACP;WAID,UAAK,MAFJ,QAAA,GAAA,KAAA,gBAAA,IAEe,IACjB;;CAEJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { OpenFeaturePluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: OpenFeaturePluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,kBAAkB,SAA2C;AAC3E,QAAO,UAAU,QAAQ,OAAO,MAAM,QAAQ,YAAY"}
1
+ {"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { OpenFeaturePluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: OpenFeaturePluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,kBAAkB,SAAS;AACzC,QAAO,UAAU,QAAQ,OAAO,MAAM,QAAQ,YAAY"}
package/dist/index.cjs CHANGED
@@ -2,9 +2,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_helpers_automd_generator = require('./helpers/automd-generator.cjs');
4
4
  const require_components_features_builtin = require('./components/features-builtin.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
6
  let defu = require("defu");
6
7
  defu = require_runtime.__toESM(defu);
7
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
8
  let _powerlines_plugin_alloy = require("@powerlines/plugin-alloy");
9
9
  _powerlines_plugin_alloy = require_runtime.__toESM(_powerlines_plugin_alloy);
10
10
  let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
@@ -22,7 +22,7 @@ const plugin = (options = {}) => {
22
22
  name: "open-feature",
23
23
  async prepare() {
24
24
  this.debug(`Preparing the Feature Flags runtime artifacts for the Powerlines project.`);
25
- return (0, _powerlines_plugin_alloy_render.render)(this, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_components_features_builtin.FeaturesBuiltin, {}));
25
+ return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_features_builtin.FeaturesBuiltin, {}));
26
26
  }
27
27
  },
28
28
  {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { features } from "./helpers/automd-generator.mjs";
2
2
  import { FeaturesBuiltin } from "./components/features-builtin.mjs";
3
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
3
4
  import defu from "defu";
4
- import { jsx } from "@alloy-js/core/jsx-runtime";
5
5
  import alloy from "@powerlines/plugin-alloy";
6
6
  import { render } from "@powerlines/plugin-alloy/render";
7
7
  import automd from "@powerlines/plugin-automd";
@@ -17,7 +17,7 @@ const plugin = (options = {}) => {
17
17
  name: "open-feature",
18
18
  async prepare() {
19
19
  this.debug(`Preparing the Feature Flags runtime artifacts for the Powerlines project.`);
20
- return render(this, /* @__PURE__ */ jsx(FeaturesBuiltin, {}));
20
+ return render(this, createComponent(FeaturesBuiltin, {}));
21
21
  }
22
22
  },
23
23
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport alloy from \"@powerlines/plugin-alloy\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { FeaturesBuiltin } from \"./components/features-builtin\";\nimport { features } from \"./helpers/automd-generator\";\nimport type {\n OpenFeaturePluginContext,\n OpenFeaturePluginOptions\n} from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n openFeature?: OpenFeaturePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <\n TContext extends OpenFeaturePluginContext = OpenFeaturePluginContext\n>(\n options: OpenFeaturePluginOptions = {}\n) => {\n return [\n alloy(options.alloy),\n {\n name: \"open-feature\",\n async prepare() {\n this.debug(\n `Preparing the Feature Flags runtime artifacts for the Powerlines project.`\n );\n\n return render(this, <FeaturesBuiltin />);\n }\n },\n {\n name: \"open-feature:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n features: features(this)\n }\n })\n };\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAyCA,MAAa,UAGX,UAAoC,EAAE,KACnC;AACH,QAAO;EACL,MAAM,QAAQ,MAAM;EACpB;GACE,MAAM;GACN,MAAM,UAAU;AACd,SAAK,MACH,4EACD;AAED,WAAO,OAAO,MAAM,oBAAC,iBAAD,EAAmB,EAAC;;GAE3C;EACD;GACE,MAAM;GACN,SAAS;AACP,WAAO,EACL,QAAQ,KAAK,QAAQ,UAAU,EAAE,EAAE,EACjC,YAAY,EACV,UAAU,SAAS,KAAK,EACzB,EACF,CAAC,EACH;;GAEJ;EACD,OAAO,QAAQ,OAAO;EACvB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport alloy from \"@powerlines/plugin-alloy\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { FeaturesBuiltin } from \"./components/features-builtin\";\nimport { features } from \"./helpers/automd-generator\";\nimport type {\n OpenFeaturePluginContext,\n OpenFeaturePluginOptions\n} from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n openFeature?: OpenFeaturePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <\n TContext extends OpenFeaturePluginContext = OpenFeaturePluginContext\n>(\n options: OpenFeaturePluginOptions = {}\n) => {\n return [\n alloy(options.alloy),\n {\n name: \"open-feature\",\n async prepare() {\n this.debug(\n `Preparing the Feature Flags runtime artifacts for the Powerlines project.`\n );\n\n return render(this, <FeaturesBuiltin />);\n }\n },\n {\n name: \"open-feature:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n features: features(this)\n }\n })\n };\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AA8BA,QAAO;EAAA,MAAO,QAAQ,MAAM;EAAA;;GAE5B,MAAQ,UAAQ;AACd,SAAS,MAAC,4EAAO;AACf,WAAA,OAAc,MAAA,gBAAwB,iBAAA,EAAA,CAAA,CAAA;;GAE1C;EAAA;;GAEE,SAAA;AACG,WAAA,EACH,QAAA,KAAA,QAAA,UAAA,EAAA,EAAA,EACK,YAAe,EACX,UAAQ,SAAA,KAAA,EAClB,EACQ,CAAC,EACL;;GAEF;EAAC,OAAM,QAAQ,OAAM;EAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-open-feature",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin for managing Open Feature feature flags at runtime.",
6
6
  "keywords": [
@@ -169,11 +169,11 @@
169
169
  "@alloy-js/json": "0.23.0-dev.2",
170
170
  "@alloy-js/markdown": "0.23.0-dev.1",
171
171
  "@alloy-js/typescript": "0.23.0-dev.4",
172
- "@openfeature/core": "^1.9.2",
173
- "@openfeature/server-sdk": "^1.20.2",
174
- "@powerlines/plugin-alloy": "^0.26.26",
175
- "@powerlines/plugin-automd": "^0.1.408",
176
- "@powerlines/plugin-plugin": "^0.12.359",
172
+ "@openfeature/core": "^1.10.0",
173
+ "@openfeature/server-sdk": "^1.21.0",
174
+ "@powerlines/plugin-alloy": "^0.26.28",
175
+ "@powerlines/plugin-automd": "^0.1.410",
176
+ "@powerlines/plugin-plugin": "^0.12.361",
177
177
  "@storm-software/config-tools": "^1.189.77",
178
178
  "@stryke/convert": "^0.6.58",
179
179
  "@stryke/env": "^0.20.83",
@@ -185,15 +185,15 @@
185
185
  "@stryke/types": "^0.11.3",
186
186
  "automd": "^0.4.3",
187
187
  "defu": "^6.1.7",
188
- "powerlines": "^0.43.7",
188
+ "powerlines": "^0.43.9",
189
189
  "c12": "^3.3.4"
190
190
  },
191
191
  "devDependencies": {
192
192
  "@openfeature/flagd-provider": "^0.14.0",
193
- "@openfeature/server-sdk": "^1.20.2",
193
+ "@openfeature/server-sdk": "^1.21.0",
194
194
  "@types/node": "^25.6.0",
195
- "vite": "^8.0.9"
195
+ "vite": "^8.0.10"
196
196
  },
197
197
  "publishConfig": { "access": "public" },
198
- "gitHead": "b7dcad6bc06c093b3a839ab89438129c56f72813"
198
+ "gitHead": "507b498ea7a291431e92f4ebfb82978f07e45a47"
199
199
  }