@ops-ai/toggly-docusaurus-plugin 0.3.0 → 0.4.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/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -58
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
* for gating documentation content with Toggly feature flags.
|
|
6
6
|
*/
|
|
7
7
|
import type { Plugin, LoadContext } from '@docusaurus/types';
|
|
8
|
+
/**
|
|
9
|
+
* A docs-style content directory that the plugin should scan for x-feature frontmatter.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors @docusaurus/plugin-content-docs's `path` and `routeBasePath` options.
|
|
12
|
+
* Use this when your site has multiple plugin-content-docs instances
|
|
13
|
+
* (e.g. `docs/`, `sdks/`, `guides/`) — by default the plugin auto-detects them
|
|
14
|
+
* from `siteConfig.plugins`, but you can override the discovery here.
|
|
15
|
+
*/
|
|
16
|
+
export interface TogglyContentRoot {
|
|
17
|
+
/** Directory (relative to siteDir) containing MD/MDX files. */
|
|
18
|
+
path: string;
|
|
19
|
+
/** URL prefix for routes generated from this directory (no leading/trailing slash needed). */
|
|
20
|
+
routeBasePath: string;
|
|
21
|
+
}
|
|
8
22
|
export interface TogglyPluginOptions {
|
|
9
23
|
/** Base URI for the Toggly API (default: 'https://client.toggly.io') */
|
|
10
24
|
baseURI?: string;
|
|
@@ -34,11 +48,45 @@ export interface TogglyPluginOptions {
|
|
|
34
48
|
* (default: true)
|
|
35
49
|
*/
|
|
36
50
|
renderAllDuringBuild?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Explicit list of docs-style content directories to scan. When omitted,
|
|
53
|
+
* the plugin auto-detects content-docs plugin instances from `siteConfig.plugins`
|
|
54
|
+
* and always includes the classic preset's default `{ path: 'docs', routeBasePath: 'docs' }`.
|
|
55
|
+
* Set this to take full manual control of discovery.
|
|
56
|
+
*/
|
|
57
|
+
contentRoots?: TogglyContentRoot[];
|
|
37
58
|
}
|
|
38
59
|
/**
|
|
39
60
|
* Docusaurus plugin for Toggly feature flag gating
|
|
40
61
|
*/
|
|
41
62
|
export default function togglyPlugin(context: LoadContext, options: TogglyPluginOptions): Plugin;
|
|
63
|
+
/**
|
|
64
|
+
* Resolve the set of content roots the plugin should scan.
|
|
65
|
+
*
|
|
66
|
+
* Strategy:
|
|
67
|
+
* 1. If `contentRootsOverride` is provided, use it verbatim (caller knows best).
|
|
68
|
+
* 2. Otherwise, auto-detect by scanning `siteConfig.plugins` for
|
|
69
|
+
* `@docusaurus/plugin-content-docs` instances and reading each one's
|
|
70
|
+
* `path`/`routeBasePath` options. The classic preset's default
|
|
71
|
+
* `{ path: 'docs', routeBasePath: 'docs' }` is always included so existing
|
|
72
|
+
* sites keep working without configuration.
|
|
73
|
+
*
|
|
74
|
+
* Exported for testing.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveContentRoots(context: LoadContext, contentRootsOverride?: TogglyContentRoot[]): TogglyContentRoot[];
|
|
77
|
+
/**
|
|
78
|
+
* Inspect `siteConfig.plugins` for plugin-content-docs instances and return
|
|
79
|
+
* their { path, routeBasePath } pairs. Plugin entries can be:
|
|
80
|
+
* - 'plugin-id' → no options
|
|
81
|
+
* - ['plugin-id', { path, routeBasePath }] → options inline
|
|
82
|
+
* - a function/object plugin → not introspectable, skip
|
|
83
|
+
*
|
|
84
|
+
* If a plugin omits `path` or `routeBasePath`, those default to 'docs'
|
|
85
|
+
* (matching @docusaurus/plugin-content-docs's own defaults).
|
|
86
|
+
*
|
|
87
|
+
* Exported for testing.
|
|
88
|
+
*/
|
|
89
|
+
export declare function discoverContentRootsFromConfig(context: LoadContext): TogglyContentRoot[];
|
|
42
90
|
export { TogglyProvider, useToggly, useFlag, Feature } from './client';
|
|
43
91
|
export type { TogglyProviderProps, TogglyContextValue, FeatureProps, } from './client';
|
|
44
92
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAMzF,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,mFAAmF;IACnF,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAMzF;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,mFAAmF;IACnF,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACpC;AAmBD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,mBAAmB,GAC3B,MAAM,CAoLR;AAGD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,oBAAoB,CAAC,EAAE,iBAAiB,EAAE,GACzC,iBAAiB,EAAE,CAkBrB;AAoBD;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,WAAW,GAAG,iBAAiB,EAAE,CAsBxF;AAmGD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvE,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,GACb,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import webpack from 'webpack';
|
|
|
13
13
|
*/
|
|
14
14
|
export default function togglyPlugin(context, options) {
|
|
15
15
|
const { baseURI = 'https://client.toggly.io', appKey, environment = 'Production', flagDefaults = {}, featureFlagsRefreshInterval = 3 * 60 * 1000, isDebug = false, connectTimeout = 5 * 1000, identity, renderAllDuringBuild = true, // Default to true for better DX
|
|
16
|
-
|
|
16
|
+
contentRoots, } = options;
|
|
17
17
|
// Store page feature mapping for postBuild
|
|
18
18
|
let pageFeatureMapping = {};
|
|
19
19
|
return {
|
|
@@ -43,10 +43,18 @@ export default function togglyPlugin(context, options) {
|
|
|
43
43
|
async contentLoaded({ content, actions }) {
|
|
44
44
|
try {
|
|
45
45
|
const { config: pluginConfig } = content;
|
|
46
|
-
// Extract page feature mapping from files
|
|
47
|
-
// We parse files directly to get x-feature frontmatter
|
|
48
|
-
//
|
|
49
|
-
|
|
46
|
+
// Extract page feature mapping from files.
|
|
47
|
+
// We parse files directly to get x-feature frontmatter and map to
|
|
48
|
+
// routes using each content root's routeBasePath. Roots are either
|
|
49
|
+
// supplied explicitly via `contentRoots` or auto-detected from
|
|
50
|
+
// `siteConfig.plugins` (with the classic preset's `docs/` always included).
|
|
51
|
+
const roots = resolveContentRoots(context, contentRoots);
|
|
52
|
+
if (isDebug) {
|
|
53
|
+
console.log(`[Toggly Plugin] Scanning content roots: ${roots
|
|
54
|
+
.map(r => `${r.path} -> /${r.routeBasePath}`)
|
|
55
|
+
.join(', ')}`);
|
|
56
|
+
}
|
|
57
|
+
pageFeatureMapping = await extractFromFiles(context, roots);
|
|
50
58
|
// Store data for configureWebpack and postBuild
|
|
51
59
|
this.__togglyPluginData = {
|
|
52
60
|
pageFeatureMapping,
|
|
@@ -145,74 +153,150 @@ export default function togglyPlugin(context, options) {
|
|
|
145
153
|
};
|
|
146
154
|
}
|
|
147
155
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
156
|
+
* Resolve the set of content roots the plugin should scan.
|
|
157
|
+
*
|
|
158
|
+
* Strategy:
|
|
159
|
+
* 1. If `contentRootsOverride` is provided, use it verbatim (caller knows best).
|
|
160
|
+
* 2. Otherwise, auto-detect by scanning `siteConfig.plugins` for
|
|
161
|
+
* `@docusaurus/plugin-content-docs` instances and reading each one's
|
|
162
|
+
* `path`/`routeBasePath` options. The classic preset's default
|
|
163
|
+
* `{ path: 'docs', routeBasePath: 'docs' }` is always included so existing
|
|
164
|
+
* sites keep working without configuration.
|
|
165
|
+
*
|
|
166
|
+
* Exported for testing.
|
|
150
167
|
*/
|
|
151
|
-
|
|
168
|
+
export function resolveContentRoots(context, contentRootsOverride) {
|
|
169
|
+
if (contentRootsOverride && contentRootsOverride.length > 0) {
|
|
170
|
+
return contentRootsOverride.map(normalizeContentRoot);
|
|
171
|
+
}
|
|
172
|
+
const discovered = discoverContentRootsFromConfig(context);
|
|
173
|
+
const roots = new Map();
|
|
174
|
+
// Always include the classic preset's docs root.
|
|
175
|
+
const fallback = normalizeContentRoot({ path: 'docs', routeBasePath: 'docs' });
|
|
176
|
+
roots.set(rootKey(fallback), fallback);
|
|
177
|
+
for (const root of discovered) {
|
|
178
|
+
const normalized = normalizeContentRoot(root);
|
|
179
|
+
roots.set(rootKey(normalized), normalized);
|
|
180
|
+
}
|
|
181
|
+
return Array.from(roots.values());
|
|
182
|
+
}
|
|
183
|
+
function normalizeContentRoot(root) {
|
|
184
|
+
const trimmedPath = root.path.replace(/^[/\\]+|[/\\]+$/g, '');
|
|
185
|
+
const trimmedRouteBasePath = root.routeBasePath.replace(/^\/+|\/+$/g, '');
|
|
186
|
+
return {
|
|
187
|
+
path: trimmedPath,
|
|
188
|
+
routeBasePath: trimmedRouteBasePath,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function rootKey(root) {
|
|
192
|
+
return `${root.path}|${root.routeBasePath}`;
|
|
193
|
+
}
|
|
194
|
+
const CONTENT_DOCS_PLUGIN_NAMES = new Set([
|
|
195
|
+
'@docusaurus/plugin-content-docs',
|
|
196
|
+
'plugin-content-docs',
|
|
197
|
+
]);
|
|
198
|
+
/**
|
|
199
|
+
* Inspect `siteConfig.plugins` for plugin-content-docs instances and return
|
|
200
|
+
* their { path, routeBasePath } pairs. Plugin entries can be:
|
|
201
|
+
* - 'plugin-id' → no options
|
|
202
|
+
* - ['plugin-id', { path, routeBasePath }] → options inline
|
|
203
|
+
* - a function/object plugin → not introspectable, skip
|
|
204
|
+
*
|
|
205
|
+
* If a plugin omits `path` or `routeBasePath`, those default to 'docs'
|
|
206
|
+
* (matching @docusaurus/plugin-content-docs's own defaults).
|
|
207
|
+
*
|
|
208
|
+
* Exported for testing.
|
|
209
|
+
*/
|
|
210
|
+
export function discoverContentRootsFromConfig(context) {
|
|
211
|
+
const result = [];
|
|
212
|
+
const plugins = (context.siteConfig?.plugins ?? []);
|
|
213
|
+
for (const entry of plugins) {
|
|
214
|
+
if (!Array.isArray(entry) || entry.length === 0) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const [name, opts] = entry;
|
|
218
|
+
if (typeof name !== 'string')
|
|
219
|
+
continue;
|
|
220
|
+
if (!CONTENT_DOCS_PLUGIN_NAMES.has(name))
|
|
221
|
+
continue;
|
|
222
|
+
const options = (opts && typeof opts === 'object' ? opts : {});
|
|
223
|
+
const pathValue = typeof options.path === 'string' ? options.path : 'docs';
|
|
224
|
+
const routeBasePathValue = typeof options.routeBasePath === 'string' ? options.routeBasePath : 'docs';
|
|
225
|
+
result.push({ path: pathValue, routeBasePath: routeBasePathValue });
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Extract page feature mapping by parsing MD/MDX files in the given content roots.
|
|
231
|
+
* Maps file paths to Docusaurus route paths using each root's `routeBasePath`.
|
|
232
|
+
*/
|
|
233
|
+
async function extractFromFiles(context, roots) {
|
|
234
|
+
const pageFeatureMapping = {};
|
|
235
|
+
for (const root of roots) {
|
|
236
|
+
const rootMappings = await extractFromRoot(context, root);
|
|
237
|
+
Object.assign(pageFeatureMapping, rootMappings);
|
|
238
|
+
}
|
|
239
|
+
return pageFeatureMapping;
|
|
240
|
+
}
|
|
241
|
+
async function extractFromRoot(context, root) {
|
|
152
242
|
const { siteDir, baseUrl } = context;
|
|
153
|
-
const
|
|
243
|
+
const rootDir = path.isAbsolute(root.path)
|
|
244
|
+
? root.path
|
|
245
|
+
: path.join(siteDir, root.path);
|
|
154
246
|
const pageFeatureMapping = {};
|
|
155
|
-
|
|
156
|
-
if (!fs.existsSync(docsDir)) {
|
|
247
|
+
if (!fs.existsSync(rootDir)) {
|
|
157
248
|
return pageFeatureMapping;
|
|
158
249
|
}
|
|
159
|
-
// Find all MD/MDX files in the docs directory
|
|
160
250
|
const files = await glob('**/*.{md,mdx}', {
|
|
161
|
-
cwd:
|
|
251
|
+
cwd: rootDir,
|
|
162
252
|
absolute: false,
|
|
163
253
|
ignore: ['node_modules/**'],
|
|
164
254
|
});
|
|
165
255
|
const stripOrderPrefix = (seg) => seg.replace(/^\d+-/, '');
|
|
256
|
+
const normalizedRouteBase = root.routeBasePath; // already trimmed of slashes
|
|
166
257
|
for (const file of files) {
|
|
167
|
-
const filePath = path.join(
|
|
258
|
+
const filePath = path.join(rootDir, file);
|
|
168
259
|
const content = fs.readFileSync(filePath, 'utf-8');
|
|
169
|
-
// Extract frontmatter
|
|
170
260
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
|
|
171
|
-
if (frontmatterMatch)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let routePath = normalized.replace(/\.(md|mdx)$/, '');
|
|
189
|
-
// Handle index files - they become the parent directory route
|
|
190
|
-
if (path.basename(routePath) === 'index') {
|
|
191
|
-
routePath = path.dirname(routePath);
|
|
192
|
-
if (routePath === '.') {
|
|
193
|
-
routePath = '';
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
// Ensure path starts with /
|
|
197
|
-
if (!routePath.startsWith('/')) {
|
|
198
|
-
routePath = '/' + routePath;
|
|
199
|
-
}
|
|
200
|
-
// Prepend /docs/ if not already there
|
|
201
|
-
if (!routePath.startsWith('/docs')) {
|
|
202
|
-
routePath = '/docs' + routePath;
|
|
203
|
-
}
|
|
204
|
-
// Remove trailing slash (except for root /docs)
|
|
205
|
-
routePath = routePath.replace(/\/$/, '') || '/docs';
|
|
206
|
-
// Prepend baseUrl if not root
|
|
207
|
-
// baseUrl is typically '/' but can be '/project-name/' for GitHub Pages
|
|
208
|
-
let fullRoutePath = routePath;
|
|
209
|
-
if (baseUrl !== '/') {
|
|
210
|
-
const normalizedBaseUrl = baseUrl.replace(/\/$/, '');
|
|
211
|
-
fullRoutePath = normalizedBaseUrl + routePath;
|
|
212
|
-
}
|
|
213
|
-
pageFeatureMapping[fullRoutePath] = featureKey;
|
|
261
|
+
if (!frontmatterMatch)
|
|
262
|
+
continue;
|
|
263
|
+
const xFeatureMatch = frontmatterMatch[1].match(/^x-feature:\s*(.+)$/m);
|
|
264
|
+
if (!xFeatureMatch)
|
|
265
|
+
continue;
|
|
266
|
+
const featureKey = xFeatureMatch[1].trim().replace(/^["']|["']$/g, '');
|
|
267
|
+
const normalized = file
|
|
268
|
+
.replace(/\\/g, '/')
|
|
269
|
+
.split('/')
|
|
270
|
+
.map(stripOrderPrefix)
|
|
271
|
+
.join('/');
|
|
272
|
+
let relativeRoute = normalized.replace(/\.(md|mdx)$/, '');
|
|
273
|
+
// Index files become the parent directory route
|
|
274
|
+
if (path.basename(relativeRoute) === 'index') {
|
|
275
|
+
relativeRoute = path.dirname(relativeRoute);
|
|
276
|
+
if (relativeRoute === '.') {
|
|
277
|
+
relativeRoute = '';
|
|
214
278
|
}
|
|
215
279
|
}
|
|
280
|
+
relativeRoute = relativeRoute.replace(/^\/+/, '');
|
|
281
|
+
let routePath;
|
|
282
|
+
if (normalizedRouteBase === '') {
|
|
283
|
+
// Root-level routes (routeBasePath: '/') — file paths map directly under '/'.
|
|
284
|
+
routePath = relativeRoute === '' ? '/' : `/${relativeRoute}`;
|
|
285
|
+
}
|
|
286
|
+
else if (relativeRoute === '') {
|
|
287
|
+
routePath = `/${normalizedRouteBase}`;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
routePath = `/${normalizedRouteBase}/${relativeRoute}`;
|
|
291
|
+
}
|
|
292
|
+
routePath = routePath.replace(/\/+$/, '') || '/';
|
|
293
|
+
// Prepend baseUrl when the site is served from a subpath (e.g. GitHub Pages).
|
|
294
|
+
let fullRoutePath = routePath;
|
|
295
|
+
if (baseUrl && baseUrl !== '/') {
|
|
296
|
+
const normalizedBaseUrl = baseUrl.replace(/\/+$/, '');
|
|
297
|
+
fullRoutePath = routePath === '/' ? normalizedBaseUrl || '/' : normalizedBaseUrl + routePath;
|
|
298
|
+
}
|
|
299
|
+
pageFeatureMapping[fullRoutePath] = featureKey;
|
|
216
300
|
}
|
|
217
301
|
return pageFeatureMapping;
|
|
218
302
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;AAsE9B;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,OAAoB,EACpB,OAA4B;IAE5B,MAAM,EACJ,OAAO,GAAG,0BAA0B,EACpC,MAAM,EACN,WAAW,GAAG,YA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9E,SAAS,GAAG,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAAC;QAC/D,CAAC;aAAM,IAAI,aAAa,KAAK,EAAE,EAAE,CAAC;YAChC,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,IAAI,mBAAmB,IAAI,aAAa,EAAE,CAAC;QACzD,CAAC;QAED,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;QAEjD,8EAA8E;QAC9E,IAAI,aAAa,GAAG,SAAS,CAAC;QAC9B,IAAI,OAAO,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;YAC/B,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACtD,aAAa,GAAG,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,iBAAiB,IAAI,GAAG,CAAC,CAAC,CAAC,iBAAiB,GAAG,SAAS,CAAC;QAC/F,CAAC;QAED,kBAAkB,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;IACjD,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,oCAAoC;AACpC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ops-ai/toggly-docusaurus-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Docusaurus plugin and React bindings for Toggly feature flag gating",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
"clean": "rm -rf dist",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"lint": "eslint src --ext .ts,.tsx",
|
|
29
|
-
"test": "
|
|
30
|
-
"test:watch": "
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest --watch",
|
|
31
|
+
"test:coverage": "vitest run --coverage"
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"toggly",
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
"@docusaurus/types": "^3.9.2",
|
|
60
61
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
62
|
"@testing-library/react": "^14.0.0",
|
|
62
|
-
"@types/jest": "^29.0.0",
|
|
63
63
|
"@types/node": "^20.0.0",
|
|
64
64
|
"@types/react": "^18.2.0",
|
|
65
65
|
"@types/react-dom": "^18.2.0",
|
|
@@ -69,11 +69,10 @@
|
|
|
69
69
|
"@typescript-eslint/parser": "^6.0.0",
|
|
70
70
|
"eslint": "^8.57.0",
|
|
71
71
|
"eslint-config-prettier": "^9.1.0",
|
|
72
|
-
"jest": "^29.0.0",
|
|
73
|
-
"jest-environment-jsdom": "^29.0.0",
|
|
74
72
|
"react": "^18.3.1",
|
|
75
|
-
"ts-jest": "^29.0.0",
|
|
76
73
|
"typescript": "^5.3.3",
|
|
74
|
+
"vitest": "^1.6.0",
|
|
75
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
77
76
|
"webpack": "^5.104.1",
|
|
78
77
|
"ws": "^8.0.0"
|
|
79
78
|
}
|