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.
- package/LICENSE +1 -1
- package/README.md +14 -16
- package/dist/feature-toggle.js +227 -385
- package/dist/feature-toggle.js.map +1 -0
- package/dist/featureToggle.d.ts +3 -0
- package/dist/html-plugin.js +42 -0
- package/dist/html-plugin.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/plugins/htmlplugin/plugin-html.d.ts +15 -0
- package/dist/plugins/urlplugin/plugin-url.d.ts +14 -0
- package/dist/{feature-toggle.d.ts → types.d.ts} +17 -54
- package/dist/url-plugin.js +40 -0
- package/dist/url-plugin.js.map +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +26 -11
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
- package/dist/feature-toggle.min.cjs +0 -2
- package/dist/feature-toggle.min.cjs.map +0 -1
- package/dist/feature-toggle.min.js +0 -2
- package/dist/feature-toggle.min.js.map +0 -1
- package/dist/feature-toggle.umd.min.js +0 -2
- package/dist/feature-toggle.umd.min.js.map +0 -1
- package/dist/html-plugin.umd.min.js +0 -2
- package/dist/html-plugin.umd.min.js.map +0 -1
- package/dist/url-plugin.umd.min.js +0 -2
- package/dist/url-plugin.umd.min.js.map +0 -1
- package/docs/_config.yml +0 -1
- package/docs/example-intro.html +0 -75
- package/docs/example-setup.html +0 -55
- package/docs/example-visibility-basic.html +0 -144
- package/docs/readme.md +0 -628
- package/docs/vue-feature-toggle.min.js +0 -902
- package/examples/01_basic_esmodule.js +0 -10
- package/examples/02_basic_cjsmodule.cjs +0 -6
- package/examples/03_basic_scripttag.html +0 -24
- package/examples/04_example-htmlplugin.html +0 -35
- package/examples/05_example-urlplugin.html +0 -25
- package/examples/06_withListener.html +0 -21
- package/gulpfile.js +0 -65
- package/plugin-html.js +0 -1
- package/plugin-url.js +0 -1
- package/rollup.config.js +0 -107
- package/src/featureToggle.ts +0 -466
- package/src/index.ts +0 -10
- package/src/plugins/htmlplugin/plugin-html.ts +0 -83
- package/src/plugins/htmlplugin/readme.md +0 -221
- package/src/plugins/urlplugin/plugin-url.ts +0 -90
- package/src/plugins/urlplugin/readme.md +0 -92
- package/tests/featuretoggle.test.ts +0 -450
- package/tests/polyfills.ts +0 -20
- package/tsconfig.cjs.json +0 -12
- package/tsconfig.json +0 -12
package/LICENSE
CHANGED
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
|
-
|
|
76
|
-
``` javascript
|
|
77
|
-
const { useFeatureToggle } = require("feature-toggle-api/dist/feature-toggle.cjs");
|
|
75
|
+
### Upgrade note for version 5
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
85
|
-
|
|
81
|
+
``` javascript
|
|
82
|
+
import { useFeatureToggle } from "feature-toggle-api";
|
|
86
83
|
```
|
|
87
84
|
|
|
88
85
|
|
|
89
|
-
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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)
|
|
641
|
+
Copyright (c) 2026 Manuel Gelsen
|