@powerlines/plugin-open-feature 0.1.0

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.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +302 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/components/features-builtin.cjs +83 -0
  5. package/dist/components/features-builtin.d.cts +13 -0
  6. package/dist/components/features-builtin.d.cts.map +1 -0
  7. package/dist/components/features-builtin.d.mts +13 -0
  8. package/dist/components/features-builtin.d.mts.map +1 -0
  9. package/dist/components/features-builtin.mjs +81 -0
  10. package/dist/components/features-builtin.mjs.map +1 -0
  11. package/dist/components/index.cjs +4 -0
  12. package/dist/components/index.d.cts +2 -0
  13. package/dist/components/index.d.mts +2 -0
  14. package/dist/components/index.mjs +3 -0
  15. package/dist/helpers/automd-generator.cjs +33 -0
  16. package/dist/helpers/automd-generator.d.cts +14 -0
  17. package/dist/helpers/automd-generator.d.cts.map +1 -0
  18. package/dist/helpers/automd-generator.d.mts +14 -0
  19. package/dist/helpers/automd-generator.d.mts.map +1 -0
  20. package/dist/helpers/automd-generator.mjs +32 -0
  21. package/dist/helpers/automd-generator.mjs.map +1 -0
  22. package/dist/helpers/docs-helper.cjs +25 -0
  23. package/dist/helpers/docs-helper.d.cts +13 -0
  24. package/dist/helpers/docs-helper.d.cts.map +1 -0
  25. package/dist/helpers/docs-helper.d.mts +13 -0
  26. package/dist/helpers/docs-helper.d.mts.map +1 -0
  27. package/dist/helpers/docs-helper.mjs +24 -0
  28. package/dist/helpers/docs-helper.mjs.map +1 -0
  29. package/dist/helpers/index.cjs +6 -0
  30. package/dist/helpers/index.d.cts +3 -0
  31. package/dist/helpers/index.d.mts +3 -0
  32. package/dist/helpers/index.mjs +4 -0
  33. package/dist/index.cjs +40 -0
  34. package/dist/index.d.cts +16 -0
  35. package/dist/index.d.cts.map +1 -0
  36. package/dist/index.d.mts +16 -0
  37. package/dist/index.d.mts.map +1 -0
  38. package/dist/index.mjs +35 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/esm/index.cjs +643 -0
  41. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/esm/index.mjs +618 -0
  42. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/esm/index.mjs.map +1 -0
  43. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/types.d.cts +489 -0
  44. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/types.d.cts.map +1 -0
  45. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/types.d.mts +489 -0
  46. package/dist/node_modules/.pnpm/@openfeature_core@1.9.2/node_modules/@openfeature/core/dist/types.d.mts.map +1 -0
  47. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/esm/index.cjs +423 -0
  48. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/esm/index.mjs +424 -0
  49. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/esm/index.mjs.map +1 -0
  50. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/types.d.cts +41 -0
  51. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/types.d.cts.map +1 -0
  52. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/types.d.mts +42 -0
  53. package/dist/node_modules/.pnpm/@openfeature_server-sdk@1.20.2_@openfeature_core@1.9.2/node_modules/@openfeature/server-sdk/dist/types.d.mts.map +1 -0
  54. package/dist/types/index.cjs +7 -0
  55. package/dist/types/index.d.cts +2 -0
  56. package/dist/types/index.d.mts +2 -0
  57. package/dist/types/index.mjs +3 -0
  58. package/dist/types/plugin.cjs +54 -0
  59. package/dist/types/plugin.d.cts +41 -0
  60. package/dist/types/plugin.d.cts.map +1 -0
  61. package/dist/types/plugin.d.mts +41 -0
  62. package/dist/types/plugin.d.mts.map +1 -0
  63. package/dist/types/plugin.mjs +50 -0
  64. package/dist/types/plugin.mjs.map +1 -0
  65. package/package.json +201 -0
@@ -0,0 +1,81 @@
1
+ import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
2
+ import { Show, code, splitProps } from "@alloy-js/core";
3
+ import { FunctionDeclaration, VarDeclaration } from "@alloy-js/typescript";
4
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
5
+ import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
6
+ import { TSDoc, TSDocParam } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
7
+ import defu from "defu";
8
+
9
+ //#region src/components/features-builtin.tsx
10
+ /**
11
+ * Generates the feature flags module for the Powerlines project.
12
+ */
13
+ function FeaturesBuiltin(props) {
14
+ const [{ children, imports }, rest] = splitProps(props, ["children", "imports"]);
15
+ return createComponent(BuiltinFile, mergeProps({
16
+ id: "features",
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, { get children() {
39
+ return [code`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.`, createComponent(TSDocParam, {
40
+ name: "provider",
41
+ 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.`
42
+ })];
43
+ } }),
44
+ createComponent(FunctionDeclaration, {
45
+ name: "setFeatureProvider",
46
+ "export": true,
47
+ async: true,
48
+ parameters: [{
49
+ name: "provider",
50
+ type: "ProviderWrapper<Provider, ServerProviderStatus>"
51
+ }],
52
+ children: code`try {
53
+ await OpenFeature.setProviderAndWait(provider);
54
+ } catch (error) {
55
+ console.error('Failed to initialize provider:', error);
56
+ } `
57
+ }),
58
+ createComponent(Spacing, {}),
59
+ createComponent(VarDeclaration, {
60
+ name: "client",
61
+ "export": true,
62
+ "const": true,
63
+ doc: "The Open Feature runtime client to provide feature flag evaluations.",
64
+ type: "ReturnType<typeof OpenFeature.getClient>",
65
+ children: code`OpenFeature.getClient(); `
66
+ }),
67
+ createComponent(Spacing, {}),
68
+ createComponent(Show, {
69
+ get when() {
70
+ return Boolean(children);
71
+ },
72
+ children
73
+ })
74
+ ];
75
+ }
76
+ }));
77
+ }
78
+
79
+ //#endregion
80
+ export { FeaturesBuiltin };
81
+ //# sourceMappingURL=features-builtin.mjs.map
@@ -0,0 +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 interface FeaturesBuiltinProps extends 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>\n {code`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\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={true}\n const={true}\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 <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;CA+BA,MAAO,CAAA,YAEL,WACC,QAAU,WAAW,OAAO,CAAA,YAAW,UAAI,CAAA;AAI5C,QAAG,gBAAS,aAAA,WAAA;EACV,IAAC;EACD,aAAA;;EAEA,IAAC,UAAa;iBAEV,2BAAC;IAAA,EACJ,MAAA,eACI;IAAC;KACJ,MAAA;KACI,MAAI;KACR;IAAA;KACE,MAAA;KACE,MAAE;KACH;IAAE;KACD,MAAI;KACJ,MAAI;KACL;IAAC,EACH,EAAE,WAAC,EAAA,CAAA;;EAEN,IAAI,WAAW;AACb,UAAE;IAAA,gBAAA,OAAA,EACD,IAAK,WAAA;AACH,YAAO,CAAA,IAAA,0OAAqO,gBAAA,YAAA;;MAE5O,UAAW;MACT,CAAC,CAAA;OAEL,CAAC;IAAA,gBAAK,qBAAA;KACN,MAAA;KACC,UAAM;KACN,OAAA;KACA,YAAA,CAAA;MACA,MAAA;MACE,MAAA;MACD,CAAC;KACF,UAAU,IAAC;;;;;KAKZ,CAAC;IAAE,gBAAc,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KAChB,MAAE;KACF,UAAG;KACH,SAAA;KACD,KAAA;KACA,MAAA;KACC,UAAM,IAAM;KACb,CAAC;IAAA,gBAAY,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KACZ,IAAA,OAAW;AACX,aAAS,QAAK,SAAQ;;KAEhB;KACP,CAAC;IAAA;;EAEL,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_components_features_builtin = require('./features-builtin.cjs');
3
+
4
+ exports.FeaturesBuiltin = require_components_features_builtin.FeaturesBuiltin;
@@ -0,0 +1,2 @@
1
+ import { FeaturesBuiltin, FeaturesBuiltinProps, __ΩFeaturesBuiltinProps } from "./features-builtin.cjs";
2
+ export { FeaturesBuiltin, FeaturesBuiltinProps, __ΩFeaturesBuiltinProps };
@@ -0,0 +1,2 @@
1
+ import { FeaturesBuiltin, FeaturesBuiltinProps, __ΩFeaturesBuiltinProps } from "./features-builtin.mjs";
2
+ export { FeaturesBuiltin, FeaturesBuiltinProps, __ΩFeaturesBuiltinProps };
@@ -0,0 +1,3 @@
1
+ import { FeaturesBuiltin } from "./features-builtin.mjs";
2
+
3
+ export { FeaturesBuiltin };
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let powerlines = require("powerlines");
4
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let automd = require("automd");
6
+
7
+ //#region src/helpers/automd-generator.ts
8
+ function __assignType(fn, args) {
9
+ fn.__type = args;
10
+ return fn;
11
+ }
12
+ /**
13
+ * AutoMD generator to generate feature flags documentation
14
+ *
15
+ * @param context - The generator context.
16
+ * @returns The generated documentation content.
17
+ */
18
+ const features = __assignType((context) => (0, automd.defineGenerator)({
19
+ name: "features",
20
+ generate: __assignType(async function generate() {
21
+ const featuresDocFile = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "docs", "generated", "features.md");
22
+ if (!context.fs.existsSync(featuresDocFile)) return { contents: "" };
23
+ return { contents: await context.fs.read(featuresDocFile) || "" };
24
+ }, ["generate", "P\"/!"])
25
+ }), [
26
+ () => powerlines.__ΩUnresolvedContext,
27
+ "context",
28
+ "",
29
+ "Pn!2\"\"/#"
30
+ ]);
31
+
32
+ //#endregion
33
+ exports.features = features;
@@ -0,0 +1,14 @@
1
+ import * as automd from "automd";
2
+ import { UnresolvedContext } from "powerlines";
3
+
4
+ //#region src/helpers/automd-generator.d.ts
5
+ /**
6
+ * AutoMD generator to generate feature flags documentation
7
+ *
8
+ * @param context - The generator context.
9
+ * @returns The generated documentation content.
10
+ */
11
+ declare const features: (context: UnresolvedContext) => automd.Generator;
12
+ //#endregion
13
+ export { features };
14
+ //# sourceMappingURL=automd-generator.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA4BA;;;cAAa,QAAA,GAAY,OAAA,EAAS,iBAAA,KAAiB,MAAA,CAAA,SAAA"}
@@ -0,0 +1,14 @@
1
+ import { UnresolvedContext } from "powerlines";
2
+ import * as automd from "automd";
3
+
4
+ //#region src/helpers/automd-generator.d.ts
5
+ /**
6
+ * AutoMD generator to generate feature flags documentation
7
+ *
8
+ * @param context - The generator context.
9
+ * @returns The generated documentation content.
10
+ */
11
+ declare const features: (context: UnresolvedContext) => automd.Generator;
12
+ //#endregion
13
+ export { features };
14
+ //# sourceMappingURL=automd-generator.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA4BA;;;cAAa,QAAA,GAAY,OAAA,EAAS,iBAAA,KAAiB,MAAA,CAAA,SAAA"}
@@ -0,0 +1,32 @@
1
+ import { __ΩUnresolvedContext } from "powerlines";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { defineGenerator } from "automd";
4
+
5
+ //#region src/helpers/automd-generator.ts
6
+ function __assignType(fn, args) {
7
+ fn.__type = args;
8
+ return fn;
9
+ }
10
+ /**
11
+ * AutoMD generator to generate feature flags documentation
12
+ *
13
+ * @param context - The generator context.
14
+ * @returns The generated documentation content.
15
+ */
16
+ const features = __assignType((context) => defineGenerator({
17
+ name: "features",
18
+ generate: __assignType(async function generate() {
19
+ const featuresDocFile = joinPaths(context.config.root, "docs", "generated", "features.md");
20
+ if (!context.fs.existsSync(featuresDocFile)) return { contents: "" };
21
+ return { contents: await context.fs.read(featuresDocFile) || "" };
22
+ }, ["generate", "P\"/!"])
23
+ }), [
24
+ () => __ΩUnresolvedContext,
25
+ "context",
26
+ "",
27
+ "Pn!2\"\"/#"
28
+ ]);
29
+
30
+ //#endregion
31
+ export { features };
32
+ //# sourceMappingURL=automd-generator.mjs.map
@@ -0,0 +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":";;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAU;;;;;;;;AA2BX,MAAU,WAAW,cAAA,YAAA,gBAAA;CACjB,MAAE;CACF,UAAI,aAAmB,eAAA,WAAA;EACnB,MAAM,kBAAA,UAAA,QAAA,OAAA,MAAA,QAAA,aAAA,cAAA;AACN,MAAC,CAAA,QAAU,GAAA,WAAA,gBAAA,CACV,QAAS,EACX,UAAA;AAIC,SAAE,EACD,UAFM,MAAA,QAAA,GAAA,KAAA,gBAAA,IAEN,IACH;;CAEL,CAAC,EAAE;OAAO;CAAkB;CAAe;CAAC;CAAA,CAAe"}
@@ -0,0 +1,25 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_plugin = require('../types/plugin.cjs');
4
+ let _stryke_path_join = require("@stryke/path/join");
5
+
6
+ //#region src/helpers/docs-helper.ts
7
+ /**
8
+ * Gets the output path for the generated environment documentation.
9
+ *
10
+ * @param context - The environment plugin context.
11
+ * @returns The output path for the generated environment documentation.
12
+ */
13
+ function getDocsOutputPath(context) {
14
+ return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
15
+ }
16
+ getDocsOutputPath.__type = [
17
+ () => require_types_plugin.__ΩOpenFeaturePluginContext,
18
+ "context",
19
+ "getDocsOutputPath",
20
+ "Gets the output path for the generated environment documentation.",
21
+ "Pn!2\"&/#?$"
22
+ ];
23
+
24
+ //#endregion
25
+ exports.getDocsOutputPath = getDocsOutputPath;
@@ -0,0 +1,13 @@
1
+ import { OpenFeaturePluginContext } from "../types/plugin.cjs";
2
+
3
+ //#region src/helpers/docs-helper.d.ts
4
+ /**
5
+ * Gets the output path for the generated environment documentation.
6
+ *
7
+ * @param context - The environment plugin context.
8
+ * @returns The output path for the generated environment documentation.
9
+ */
10
+ declare function getDocsOutputPath(context: OpenFeaturePluginContext): string;
11
+ //#endregion
12
+ export { getDocsOutputPath };
13
+ //# sourceMappingURL=docs-helper.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-helper.d.cts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,iBAAA,CAAkB,OAAA,EAAS,wBAAA"}
@@ -0,0 +1,13 @@
1
+ import { OpenFeaturePluginContext } from "../types/plugin.mjs";
2
+
3
+ //#region src/helpers/docs-helper.d.ts
4
+ /**
5
+ * Gets the output path for the generated environment documentation.
6
+ *
7
+ * @param context - The environment plugin context.
8
+ * @returns The output path for the generated environment documentation.
9
+ */
10
+ declare function getDocsOutputPath(context: OpenFeaturePluginContext): string;
11
+ //#endregion
12
+ export { getDocsOutputPath };
13
+ //# sourceMappingURL=docs-helper.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-helper.d.mts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,iBAAA,CAAkB,OAAA,EAAS,wBAAA"}
@@ -0,0 +1,24 @@
1
+ import { __ΩOpenFeaturePluginContext } from "../types/plugin.mjs";
2
+ import { joinPaths } from "@stryke/path/join";
3
+
4
+ //#region src/helpers/docs-helper.ts
5
+ /**
6
+ * Gets the output path for the generated environment documentation.
7
+ *
8
+ * @param context - The environment plugin context.
9
+ * @returns The output path for the generated environment documentation.
10
+ */
11
+ function getDocsOutputPath(context) {
12
+ return joinPaths(context.config.root, "docs", "generated");
13
+ }
14
+ getDocsOutputPath.__type = [
15
+ () => __ΩOpenFeaturePluginContext,
16
+ "context",
17
+ "getDocsOutputPath",
18
+ "Gets the output path for the generated environment documentation.",
19
+ "Pn!2\"&/#?$"
20
+ ];
21
+
22
+ //#endregion
23
+ export { getDocsOutputPath };
24
+ //# sourceMappingURL=docs-helper.mjs.map
@@ -0,0 +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":";;;;;;;;;;AA0BA,SAAE,kBAAA,SAAA;AACF,QAAO,UAAS,QAAA,OAAkB,MAAQ,QAAC,YAAA;;AAE3C,kBAAA,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -0,0 +1,6 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_helpers_automd_generator = require('./automd-generator.cjs');
3
+ const require_helpers_docs_helper = require('./docs-helper.cjs');
4
+
5
+ exports.features = require_helpers_automd_generator.features;
6
+ exports.getDocsOutputPath = require_helpers_docs_helper.getDocsOutputPath;
@@ -0,0 +1,3 @@
1
+ import { features } from "./automd-generator.cjs";
2
+ import { getDocsOutputPath } from "./docs-helper.cjs";
3
+ export { features, getDocsOutputPath };
@@ -0,0 +1,3 @@
1
+ import { features } from "./automd-generator.mjs";
2
+ import { getDocsOutputPath } from "./docs-helper.mjs";
3
+ export { features, getDocsOutputPath };
@@ -0,0 +1,4 @@
1
+ import { features } from "./automd-generator.mjs";
2
+ import { getDocsOutputPath } from "./docs-helper.mjs";
3
+
4
+ export { features, getDocsOutputPath };
package/dist/index.cjs ADDED
@@ -0,0 +1,40 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_helpers_automd_generator = require('./helpers/automd-generator.cjs');
4
+ const require_components_features_builtin = require('./components/features-builtin.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let defu = require("defu");
7
+ defu = require_runtime.__toESM(defu);
8
+ let _powerlines_plugin_alloy = require("@powerlines/plugin-alloy");
9
+ _powerlines_plugin_alloy = require_runtime.__toESM(_powerlines_plugin_alloy);
10
+ let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
11
+ let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
12
+ _powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
13
+
14
+ //#region src/index.tsx
15
+ /**
16
+ * A Powerlines plugin to inject environment variables into the source code.
17
+ */
18
+ const plugin = (options = {}) => {
19
+ return [
20
+ (0, _powerlines_plugin_alloy.default)(options.alloy),
21
+ {
22
+ name: "open-feature",
23
+ async prepare() {
24
+ this.debug(`Preparing the Feature Flags runtime artifacts for the Powerlines project.`);
25
+ return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_features_builtin.FeaturesBuiltin, {}));
26
+ }
27
+ },
28
+ {
29
+ name: "open-feature:automd-generator",
30
+ config() {
31
+ return { automd: (0, defu.default)(options.automd ?? {}, { generators: { features: require_helpers_automd_generator.features(this) } }) };
32
+ }
33
+ },
34
+ (0, _powerlines_plugin_automd.default)(options.automd)
35
+ ];
36
+ };
37
+
38
+ //#endregion
39
+ exports.default = plugin;
40
+ exports.plugin = plugin;
@@ -0,0 +1,16 @@
1
+ import { OpenFeaturePluginContext, OpenFeaturePluginOptions, OpenFeaturePluginResolvedConfig, OpenFeaturePluginUserConfig, __ΩOpenFeaturePluginContext, __ΩOpenFeaturePluginOptions, __ΩOpenFeaturePluginResolvedConfig, __ΩOpenFeaturePluginUserConfig } from "./types/plugin.cjs";
2
+ import { Plugin } from "powerlines";
3
+
4
+ //#region src/index.d.ts
5
+ declare module "powerlines" {
6
+ interface Config {
7
+ openFeature?: OpenFeaturePluginOptions;
8
+ }
9
+ }
10
+ /**
11
+ * A Powerlines plugin to inject environment variables into the source code.
12
+ */
13
+ declare const plugin: <TContext extends OpenFeaturePluginContext = OpenFeaturePluginContext>(options?: OpenFeaturePluginOptions) => Plugin<TContext>[];
14
+ //#endregion
15
+ export { OpenFeaturePluginContext, OpenFeaturePluginOptions, OpenFeaturePluginResolvedConfig, OpenFeaturePluginUserConfig, __ΩOpenFeaturePluginContext, __ΩOpenFeaturePluginOptions, __ΩOpenFeaturePluginResolvedConfig, __ΩOpenFeaturePluginUserConfig, plugin as default, plugin };
16
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAiCY,MAAA;IACR,WAAA,GAAc,wBAAA;EAAA;AAAA;;;;cAOL,MAAA,oBACM,wBAAA,GAA2B,wBAAA,EAE5C,OAAA,GAAS,wBAAA,KA2BJ,MAAA,CAAO,QAAA"}
@@ -0,0 +1,16 @@
1
+ import { OpenFeaturePluginContext, OpenFeaturePluginOptions, OpenFeaturePluginResolvedConfig, OpenFeaturePluginUserConfig, __ΩOpenFeaturePluginContext, __ΩOpenFeaturePluginOptions, __ΩOpenFeaturePluginResolvedConfig, __ΩOpenFeaturePluginUserConfig } from "./types/plugin.mjs";
2
+ import { Plugin } from "powerlines";
3
+
4
+ //#region src/index.d.ts
5
+ declare module "powerlines" {
6
+ interface Config {
7
+ openFeature?: OpenFeaturePluginOptions;
8
+ }
9
+ }
10
+ /**
11
+ * A Powerlines plugin to inject environment variables into the source code.
12
+ */
13
+ declare const plugin: <TContext extends OpenFeaturePluginContext = OpenFeaturePluginContext>(options?: OpenFeaturePluginOptions) => Plugin<TContext>[];
14
+ //#endregion
15
+ export { OpenFeaturePluginContext, OpenFeaturePluginOptions, OpenFeaturePluginResolvedConfig, OpenFeaturePluginUserConfig, __ΩOpenFeaturePluginContext, __ΩOpenFeaturePluginOptions, __ΩOpenFeaturePluginResolvedConfig, __ΩOpenFeaturePluginUserConfig, plugin as default, plugin };
16
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAiCY,MAAA;IACR,WAAA,GAAc,wBAAA;EAAA;AAAA;;;;cAOL,MAAA,oBACM,wBAAA,GAA2B,wBAAA,EAE5C,OAAA,GAAS,wBAAA,KA2BJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,35 @@
1
+ import { features } from "./helpers/automd-generator.mjs";
2
+ import { FeaturesBuiltin } from "./components/features-builtin.mjs";
3
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
4
+ import defu from "defu";
5
+ import alloy from "@powerlines/plugin-alloy";
6
+ import { render } from "@powerlines/plugin-alloy/render";
7
+ import automd from "@powerlines/plugin-automd";
8
+
9
+ //#region src/index.tsx
10
+ /**
11
+ * A Powerlines plugin to inject environment variables into the source code.
12
+ */
13
+ const plugin = (options = {}) => {
14
+ return [
15
+ alloy(options.alloy),
16
+ {
17
+ name: "open-feature",
18
+ async prepare() {
19
+ this.debug(`Preparing the Feature Flags runtime artifacts for the Powerlines project.`);
20
+ return render(this, createComponent(FeaturesBuiltin, {}));
21
+ }
22
+ },
23
+ {
24
+ name: "open-feature:automd-generator",
25
+ config() {
26
+ return { automd: defu(options.automd ?? {}, { generators: { features: features(this) } }) };
27
+ }
28
+ },
29
+ automd(options.automd)
30
+ ];
31
+ };
32
+
33
+ //#endregion
34
+ export { plugin as default, plugin };
35
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +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 {\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":";;;;;;;;;;;;;AAsCE,QAAA;EAAA,MAAA,QAAA,MAAA;EAAA;GACE,MAAC;GACH,MAAA,UAAA;AACI,SAAC,MAAM,4EAAS;AACpB,WAAS,OAAQ,MAAA,gBAAyB,iBAAE,EAAA,CAAA,CAAA;;GAE5C;EAAA;GACE,MAAC;GACH,SAAO;AACL,WAAM,EACN,QAAA,KAAA,QAAA,UAAA,EAAA,EAAA,EACM,YAAQ,EACN,UAAU,SAAA,KAAA,EACd,EACC,CAAC,EACH;;GAEJ;EAAE,OAAG,QAAO,OAAY;EAAC"}