feature-toggle-api 4.1.0 → 5.0.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 (53) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +14 -16
  3. package/dist/feature-toggle.js +227 -385
  4. package/dist/feature-toggle.js.map +1 -0
  5. package/dist/featureToggle.d.ts +3 -0
  6. package/dist/html-plugin.js +42 -0
  7. package/dist/html-plugin.js.map +1 -0
  8. package/dist/index.d.ts +5 -0
  9. package/dist/plugins/htmlplugin/plugin-html.d.ts +15 -0
  10. package/dist/plugins/urlplugin/plugin-url.d.ts +14 -0
  11. package/dist/{feature-toggle.d.ts → types.d.ts} +17 -54
  12. package/dist/url-plugin.js +40 -0
  13. package/dist/url-plugin.js.map +1 -0
  14. package/dist/vite.config.d.ts +2 -0
  15. package/package.json +26 -11
  16. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  17. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  18. package/dist/feature-toggle.min.cjs +0 -2
  19. package/dist/feature-toggle.min.cjs.map +0 -1
  20. package/dist/feature-toggle.min.js +0 -2
  21. package/dist/feature-toggle.min.js.map +0 -1
  22. package/dist/feature-toggle.umd.min.js +0 -2
  23. package/dist/feature-toggle.umd.min.js.map +0 -1
  24. package/dist/html-plugin.umd.min.js +0 -2
  25. package/dist/html-plugin.umd.min.js.map +0 -1
  26. package/dist/url-plugin.umd.min.js +0 -2
  27. package/dist/url-plugin.umd.min.js.map +0 -1
  28. package/docs/_config.yml +0 -1
  29. package/docs/example-intro.html +0 -75
  30. package/docs/example-setup.html +0 -55
  31. package/docs/example-visibility-basic.html +0 -144
  32. package/docs/readme.md +0 -628
  33. package/docs/vue-feature-toggle.min.js +0 -902
  34. package/examples/01_basic_esmodule.js +0 -10
  35. package/examples/02_basic_cjsmodule.cjs +0 -6
  36. package/examples/03_basic_scripttag.html +0 -24
  37. package/examples/04_example-htmlplugin.html +0 -35
  38. package/examples/05_example-urlplugin.html +0 -25
  39. package/examples/06_withListener.html +0 -21
  40. package/gulpfile.js +0 -65
  41. package/plugin-html.js +0 -1
  42. package/plugin-url.js +0 -1
  43. package/rollup.config.js +0 -107
  44. package/src/featureToggle.ts +0 -466
  45. package/src/index.ts +0 -10
  46. package/src/plugins/htmlplugin/plugin-html.ts +0 -83
  47. package/src/plugins/htmlplugin/readme.md +0 -221
  48. package/src/plugins/urlplugin/plugin-url.ts +0 -90
  49. package/src/plugins/urlplugin/readme.md +0 -92
  50. package/tests/featuretoggle.test.ts +0 -450
  51. package/tests/polyfills.ts +0 -20
  52. package/tsconfig.cjs.json +0 -12
  53. package/tsconfig.json +0 -12
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 bassdman
3
+ Copyright (c) 2025 bassdman
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -72,38 +72,36 @@ console.log(feature.isActive('a')); //true
72
72
  console.log(feature.isActive('c')); //false
73
73
  ```
74
74
 
75
- You use commonjs-scripts? Here we go:
76
- ``` javascript
77
- const { useFeatureToggle } = require("feature-toggle-api/dist/feature-toggle.cjs");
75
+ ### Upgrade note for version 5
78
76
 
79
- //initialize it with your feature-flags
80
- const feature = useFeatureToggle({
81
- a:true,
82
- });
77
+ Version 5 keeps the feature-toggle API unchanged, but only ships ESM builds.
78
+ The CommonJS entry points and generated `.cjs` files are no longer included.
79
+ Projects using `require("feature-toggle-api")` must migrate to an ESM import:
83
80
 
84
- console.log(feature.isActive('a')); //true
85
- console.log(feature.isActive('c')); //false
81
+ ``` javascript
82
+ import { useFeatureToggle } from "feature-toggle-api";
86
83
  ```
87
84
 
88
85
 
89
- Or you want to include it as a scripttag? Here's a sample HTML-File.
86
+ For browser applications, import the ESM build through your bundler or a module script.
90
87
  ``` html
91
88
  <!DOCTYPE html>
92
89
  <html lang="en">
93
90
  <head>
94
91
  <meta charset="UTF-8">
95
92
  <title>Basic Feature-Toggle-API-Test</title>
96
- <script src="path/to/feature-toggle-api/dist/feature-toggle.umd.min.js"></script>
97
93
  </head>
98
94
  <body>
99
95
  <div class="feature1">This is text from feature1</div>
100
96
  <div class="feature2">This is text from feature2</div>
101
- <script>
102
- var api = useFeatureToggle({
97
+ <script type="module">
98
+ import { useFeatureToggle } from "./node_modules/feature-toggle-api/dist/feature-toggle.js";
99
+
100
+ const api = useFeatureToggle({
103
101
  feature1: true
104
102
  });
105
- var feature1Visible = api.isActive('feature1');
106
- var feature2Visible = api.isActive('feature2');
103
+ const feature1Visible = api.isActive('feature1');
104
+ const feature2Visible = api.isActive('feature2');
107
105
 
108
106
  //here we could also use jquery or any other library,... The api has done its job.
109
107
  if(!feature1Visible) document.querySelector(".feature1").style.display = 'none';
@@ -640,4 +638,4 @@ api.showLogs(true);
640
638
 
641
639
  ## License
642
640
  <a href="https://opensource.org/licenses/MIT">MIT</a>.
643
- Copyright (c) 2018 Manuel Gelsen
641
+ Copyright (c) 2026 Manuel Gelsen