From d0ce7f1f89e770afda63a54d0992b0e33e1ae427 Mon Sep 17 00:00:00 2001 From: Tom Pereira Date: Tue, 24 Dec 2024 17:31:32 +0000 Subject: [PATCH 01/24] change initial commit message in changelogs (#3) --- docs/CHANGELOG.md | 2 +- packages/features/docs/CHANGELOG.md | 2 +- packages/react-pointcuts/docs/CHANGELOG.md | 2 +- packages/ssr/docs/CHANGELOG.md | 2 +- packages/webpack/docs/CHANGELOG.md | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fe59d05..6f9d606 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -233,4 +233,4 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). ### Added -- Initial version, copying code from PLP. +- Initial commit. diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index be37a9f..abc3dd8 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -93,4 +93,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Initial version, copying code from PLP +- Initial commit. diff --git a/packages/react-pointcuts/docs/CHANGELOG.md b/packages/react-pointcuts/docs/CHANGELOG.md index 10c985a..932854d 100644 --- a/packages/react-pointcuts/docs/CHANGELOG.md +++ b/packages/react-pointcuts/docs/CHANGELOG.md @@ -103,4 +103,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Initial version, copying code from PLP +- Initial commit. diff --git a/packages/ssr/docs/CHANGELOG.md b/packages/ssr/docs/CHANGELOG.md index f7b0824..75ca4ea 100644 --- a/packages/ssr/docs/CHANGELOG.md +++ b/packages/ssr/docs/CHANGELOG.md @@ -83,4 +83,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Initial version, copying code from PLP +- Initial commit. diff --git a/packages/webpack/docs/CHANGELOG.md b/packages/webpack/docs/CHANGELOG.md index ae2c30c..5102394 100644 --- a/packages/webpack/docs/CHANGELOG.md +++ b/packages/webpack/docs/CHANGELOG.md @@ -103,5 +103,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Initial version, copying code from PLP -- Added unit tests around the plugin itself, not originally developed in PLP +- Initial commit From 27e436a05e74b57ec5de78cb88fe09594c55c70e Mon Sep 17 00:00:00 2001 From: Tom Pereira <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:30:26 +0000 Subject: [PATCH 02/24] [#18] Fix JSDoc module names (#19) * rename to proper module namespace * update docs links * update versions * web toggle point in readme title * fixup changelog from revised 0.x range * 2.0.0 -> 0.5.0 in oss version scheme * fix broken link syntax in CHANGELOG * consistent quoting * more version history issues * fixup module name in jsdoc * add web remove sdkInstanceProvider * remove SDKInstanceProvider * fixup jsdoc dedupe * tweak * clarity re: ssr package * casing etc --- docs/CHANGELOG.md | 17 +++++++++----- docs/README.md | 2 +- docs/dedupeExternalJsdocPlugin.js | 10 ++++----- package-lock.json | 12 +++++----- package.json | 2 +- packages/features/docs/CHANGELOG.md | 10 +++++++-- packages/features/docs/README.md | 2 +- packages/features/package.json | 2 +- packages/features/src/global.js | 14 ++++++------ packages/features/src/global/store.js | 10 ++++----- .../features/src/nodeRequestScoped/store.js | 10 ++++----- packages/features/src/reactContext/store.js | 10 ++++----- .../src/ssrBackedReactContext/store.js | 12 +++++----- packages/react-pointcuts/docs/CHANGELOG.md | 8 ++++++- packages/react-pointcuts/docs/README.md | 2 +- packages/react-pointcuts/package.json | 2 +- packages/react-pointcuts/src/external.js | 11 ---------- .../src/getCodeSelectionPlugins.js | 2 +- packages/react-pointcuts/src/index.js | 2 +- .../src/withTogglePointFactory/index.js | 8 +++---- .../src/withToggledHookFactory/index.js | 8 +++---- packages/ssr/docs/CHANGELOG.md | 8 ++++++- packages/ssr/docs/README.md | 2 +- packages/ssr/package.json | 2 +- packages/ssr/src/external.js | 11 ---------- packages/ssr/src/index.js | 4 ++-- .../ssr/src/serializationFactory/index.js | 22 +++++++++---------- packages/ssr/src/withJsonIsomorphism/index.js | 2 +- packages/webpack/docs/CHANGELOG.md | 6 +++++ packages/webpack/docs/README.md | 2 +- packages/webpack/package.json | 2 +- packages/webpack/src/index.js | 2 +- .../src/plugins/togglePointInjection/index.js | 2 +- 33 files changed, 115 insertions(+), 106 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6f9d606..532c7d8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,13 @@ N.B. See changelogs for individual packages, where most change will occur: This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). +## [0.10.2] - 2024-12-26 + +### Fixed + +- "Toggle Point" to "Web Toggle Point" in title of `README.md` +- fixed the dedupe external JSDoc plugin, after move to type imports + ## [0.10.1] - 2024-12-24 ### Fixed @@ -73,7 +80,7 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). ### Fixed -- Removed old `yarn.lock` left over from 1.0.3 update. +- Removed old `yarn.lock` left over from 0.4.3 update. ## Added @@ -85,7 +92,7 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). - Moved to v4 of [`upload-artifact`](https://github.com/actions/upload-artifact) and [`download-artifact`](https://github.com/actions/download-artifact) actions - Changed nature of pre-release packages to `beta` from `alpha` (better matching the reality of how these pre-releases are used) -- Fixed up contribution guide since version 2.0.0 added the proposed update checks +- Fixed up contribution guide since version 0.5.0 added the proposed update checks - Updated to JSDoc 4, issue with factories resolved ### Changed @@ -127,7 +134,7 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). ### Fixed -- Fixup documentation left fallow from package split (2.0.0) +- Fixup documentation left fallow from package split (0.5.0) - Upgrade serialize-javascript to 6.0.2 to avoid [`SNYK-JS-SERIALIZEJAVASCRIPT-614760`](https://security.snyk.io/vuln/SNYK-JS-SERIALIZEJAVASCRIPT-6147607) - snyk ignore [`SNYK-JS-INFLIGHT-6095116`](https://security.snyk.io/vuln/SNYK-JS-INFLIGHT-6095116) - move to use asos runner groups @@ -157,7 +164,7 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). ### Changed - Split the "app" package into separate "ssr", "features" and "react-pointcuts" packages. -- Move to explicit rather than wildcard workspaces, to enable reification of the repo when publishing (waiting on [https://github.com/Roaders/workspace-version/issues/3](an issue to resolve)) +- Move to explicit rather than wildcard workspaces, to enable reification of the repo when publishing (waiting on [an issue to resolve](https://github.com/Roaders/workspace-version/issues/3)) - Updated the `dedupeExternalJsdocPlugin` to de-duplicate members of external namespaces, rather than just the namespaces themselves (to ensure we don't duplicate React, HostApplication etc. in the html documentation) - Updated packages for snyk vulnerabilities, populated policy file - Removed redundant export fields from workspace `package.json` @@ -175,7 +182,7 @@ This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). ### Added -- Danger support, with checks for CHANGELOG.md updates and package-lock.json updates +- Danger support, with checks for `CHANGELOG.md` updates and `package-lock.json` updates ### Fixed diff --git a/docs/README.md b/docs/README.md index 116c4fd..e6e59fa 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@

-

Toggle Point

+

Web Toggle Point

A library providing a means to toggle or branch web application code. diff --git a/docs/dedupeExternalJsdocPlugin.js b/docs/dedupeExternalJsdocPlugin.js index e339a52..56ee304 100644 --- a/docs/dedupeExternalJsdocPlugin.js +++ b/docs/dedupeExternalJsdocPlugin.js @@ -18,15 +18,15 @@ exports.defineTags = function (dictionary) { .synonym("external"); }; -const seenExternals = new Map(); +const seen = new Map(); exports.handlers = { jsdocCommentFound: function (e) { if (e.filename.endsWith("external.js")) { - const match = e.comment.match(/external:(\S+)/); + const match = e.comment.match(/(?:[\s\S]*@typedef \{.+\} (?.+))?[\s\S]+external:(?\S+)/); if (match) { - const [external] = match; - if (!seenExternals.has(external)) { - seenExternals.set(external, true); + const symbol = match.groups.typedef || match.groups.external; + if (!seen.has(symbol)) { + seen.set(symbol, true); } else { e.comment = "/**/"; } diff --git a/package-lock.json b/package-lock.json index e3b0abd..71ede54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asos/web-toggle-point", - "version": "0.10.1", + "version": "0.10.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asos/web-toggle-point", - "version": "0.10.1", + "version": "0.10.2", "license": "MIT", "workspaces": [ "packages/features", @@ -20346,7 +20346,7 @@ }, "packages/features": { "name": "@asos/web-toggle-point-features", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0" @@ -20403,7 +20403,7 @@ }, "packages/react-pointcuts": { "name": "@asos/web-toggle-point-react-pointcuts", - "version": "0.4.0", + "version": "0.4.2", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0" @@ -20441,7 +20441,7 @@ }, "packages/ssr": { "name": "@asos/web-toggle-point-ssr", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", @@ -20477,7 +20477,7 @@ }, "packages/webpack": { "name": "@asos/web-toggle-point-webpack", - "version": "0.7.2", + "version": "0.7.3", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", diff --git a/package.json b/package.json index 5c5e40e..d72f35a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@asos/web-toggle-point", - "version": "0.10.1", + "version": "0.10.2", "repository": "git@github.com:asos/web-toggle-point.git", "homepage": "https://asos.github.io/web-toggle-point/", "license": "MIT", diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index abc3dd8..fa7b6a2 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.1] - 2024-12-26 + +### Fixed + +- updated some errant JSDoc namespaces + ## [0.3.0] - 2024-11-28 ### Changed @@ -32,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - updated to latest `@testing-library/react` to remove errant warning about import of `act` - updated to `react@18.3.1`, set minimum required react to `17` - - technically a breaking change, but `jsx-runtime` already introduced in [version 1.0.0](#100---2023-09-12)... so was already broken, oops. + - technically a breaking change, but `jsx-runtime` already introduced in [version 0.1.0](#010---2023-09-12)... so was already broken, oops. - renamed commonJs exports to have `.cjs` extension to prevent `[ERR_REQUIRE_ESM]` errors in consumers that aren't `"type": "module"` ## [0.2.2] - 2024-12-26 @@ -61,7 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixup documentation left fallow from package split (0.1.0) +- Fixup documentation left fallow from package split ([version 0.1.0](#010---2023-09-12)) ## [0.1.1] - 2023-11-16 diff --git a/packages/features/docs/README.md b/packages/features/docs/README.md index 0353466..fd7cdef 100644 --- a/packages/features/docs/README.md +++ b/packages/features/docs/README.md @@ -8,7 +8,7 @@ A store should be chosen based on the requirement for global or partitioned stat ## Usage -See: [JSDoc output](https://asos.github.io/web-toggle-point/module-asos-web-toggle-point-features.html) +See: [JSDoc output](https://asos.github.io/web-toggle-point/module-web-toggle-point-features.html) > [!WARNING] > ### Use with React 17 diff --git a/packages/features/package.json b/packages/features/package.json index 36abbcf..e38f533 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -1,7 +1,7 @@ { "name": "@asos/web-toggle-point-features", "description": "toggle point features code", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", diff --git a/packages/features/src/global.js b/packages/features/src/global.js index abf4590..bd618e8 100644 --- a/packages/features/src/global.js +++ b/packages/features/src/global.js @@ -2,21 +2,21 @@ import "./external"; /** * Application code for holding feature toggle state - * @module toggle-point-features + * @module web-toggle-point-features */ /** * Interface for feature toggle stores * * @interface FeaturesStore - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features */ /** * Method to return the value of the feature toggle store. * For {@link https://reactjs.org/docs/context.html|React context}-backed feature stores, this should be called following {@link https://react.dev/warnings/invalid-hook-call-warning|the rules of hooks} * * @function - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features * @name FeaturesStore#getFeatures */ @@ -24,13 +24,13 @@ import "./external"; * Interface for singleton value-based feature toggle stores * * @interface SingletonFeaturesStore - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features */ /** * Method to set a value to the feature toggle store. * * @function - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features * @name SingletonFeaturesStore#useValue * @param {object} params parameters * @param {object} params.value A value to store, used to drive feature toggles. @@ -40,13 +40,13 @@ import "./external"; * Interface for {@link https://reactjs.org/docs/context.html|React context}-based feature toggle stores * * @interface ContextFeaturesStore - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features */ /** * Method to create a React context provider, linked to the features store. * * @function - * @memberof module:toggle-point-features + * @memberof module:web-toggle-point-features * @name ContextFeaturesStore#providerFactory * @returns {external:React.Component} A react context provider that accepts a `value` prop, representing the feature toggle state. */ diff --git a/packages/features/src/global/store.js b/packages/features/src/global/store.js index 7722bd3..2a0c8da 100644 --- a/packages/features/src/global/store.js +++ b/packages/features/src/global/store.js @@ -8,16 +8,16 @@ const storeMap = new WeakMap(); * A thin wrapper around a singleton, used as an extension point for future plugins. * Consider {@link https://github.com/christophehurpeau/deep-freeze-es6|deep freezing} the value to prevent accidental mutation, if this is intended to be static. * For reactive decisions, consider implementing something that allows for reactivity e.g. a {@link https://github.com/pmndrs/valtio|valtio/vanilla} proxy, and subscribe appropriately in a toggle point. - * @memberof module:toggle-point-features - * @returns {module:toggle-point-features.globalFeaturesStore} A store for features, held globally in the application. + * @memberof module:web-toggle-point-features + * @returns {module:web-toggle-point-features.globalFeaturesStore} A store for features, held globally in the application. */ const globalFeaturesStoreFactory = () => { const identifier = Symbol(); /** * @name globalFeaturesStore - * @memberof module:toggle-point-features - * @implements module:toggle-point-features.FeaturesStore - * @implements module:toggle-point-features.SingletonFeaturesStore + * @memberof module:web-toggle-point-features + * @implements module:web-toggle-point-features.FeaturesStore + * @implements module:web-toggle-point-features.SingletonFeaturesStore */ return { useValue: ({ value }) => { diff --git a/packages/features/src/nodeRequestScoped/store.js b/packages/features/src/nodeRequestScoped/store.js index 0092fb4..c2232df 100644 --- a/packages/features/src/nodeRequestScoped/store.js +++ b/packages/features/src/nodeRequestScoped/store.js @@ -4,17 +4,17 @@ import { AsyncLocalStorage } from "async_hooks"; * A factory function used to create a store for features, held in request-scoped global value. * Should only be used server-side, for anything user or request specific. * A thin wrapper around node {@link https://nodejs.org/api/async_context.html#class-asynclocalstorage|AsyncLocalStorage}, used as an extension point for future plugins. - * @memberof module:toggle-point-features - * @returns {module:toggle-point-features.requestScopedFeaturesStore} A store for features, scoped for the current request. + * @memberof module:web-toggle-point-features + * @returns {module:web-toggle-point-features.requestScopedFeaturesStore} A store for features, scoped for the current request. */ const requestScopedFeaturesStoreFactory = () => { const store = new AsyncLocalStorage(); /** * @name requestScopedFeaturesStore - * @memberof module:toggle-point-features - * @implements module:toggle-point-features.FeaturesStore - * @implements module:toggle-point-features.SingletonFeaturesStore + * @memberof module:web-toggle-point-features + * @implements module:web-toggle-point-features.FeaturesStore + * @implements module:web-toggle-point-features.SingletonFeaturesStore */ return { useValue: ({ value, scopeCallBack }) => { diff --git a/packages/features/src/reactContext/store.js b/packages/features/src/reactContext/store.js index db64c55..6ef45cb 100644 --- a/packages/features/src/reactContext/store.js +++ b/packages/features/src/reactContext/store.js @@ -4,17 +4,17 @@ import PropTypes from "prop-types"; /** * A factory function used to create a store for features, held in a {@link https://reactjs.org/docs/context.html|React context}. * A thin wrapper around a context, used as an extension point for future plugins. - * @memberof module:toggle-point-features - * @returns {module:toggle-point-features.reactContextFeaturesStore} A store for features, held within a {@link https://reactjs.org/docs/context.html|React context}. + * @memberof module:web-toggle-point-features + * @returns {module:web-toggle-point-features.reactContextFeaturesStore} A store for features, held within a {@link https://reactjs.org/docs/context.html|React context}. */ const reactContextFeaturesStoreFactory = ({ name }) => { const context = createContext(); /** * @name reactContextFeaturesStore - * @memberof module:toggle-point-features - * @implements module:toggle-point-features.FeaturesStore - * @implements module:toggle-point-features.ContextFeaturesStore + * @memberof module:web-toggle-point-features + * @implements module:web-toggle-point-features.FeaturesStore + * @implements module:web-toggle-point-features.ContextFeaturesStore */ return { providerFactory: () => { diff --git a/packages/features/src/ssrBackedReactContext/store.js b/packages/features/src/ssrBackedReactContext/store.js index ea91d06..44b624f 100644 --- a/packages/features/src/ssrBackedReactContext/store.js +++ b/packages/features/src/ssrBackedReactContext/store.js @@ -3,9 +3,9 @@ import reactContextFeaturesStoreFactory from "../reactContext/store"; /** * A factory function used to create a store for features, held in a {@link https://reactjs.org/docs/context.html|React context}, backed by server-side rendering. - * A wrapper around a {@link module:toggle-point-features.reactContextFeaturesStore|reactContextFeaturesStore}, with server-side rendering supplied by the {@link module:toggle-point-ssr|toggle-point-ssr} package. - * @memberof module:toggle-point-features - * @returns {module:toggle-point-features.ssrBackedReactContextFeaturesStore} A store for features, held within a {@link https://reactjs.org/docs/context.html|React context}. + * A wrapper around a {@link module:web-toggle-point-features.reactContextFeaturesStore|reactContextFeaturesStore}, with server-side rendering supplied by the {@link module:web-toggle-point-ssr|toggle-point-ssr} package. + * @memberof module:web-toggle-point-features + * @returns {module:web-toggle-point-features.ssrBackedReactContextFeaturesStore} A store for features, held within a {@link https://reactjs.org/docs/context.html|React context}. */ const ssrBackedReactContextFeaturesStoreFactory = ({ namespace = "toggles", @@ -18,9 +18,9 @@ const ssrBackedReactContextFeaturesStoreFactory = ({ /** * @name ssrBackedReactContextFeaturesStore - * @memberof module:toggle-point-features - * @implements module:toggle-point-features.FeaturesStore - * @implements module:toggle-point-features.ContextFeaturesStore + * @memberof module:web-toggle-point-features + * @implements module:web-toggle-point-features.FeaturesStore + * @implements module:web-toggle-point-features.ContextFeaturesStore */ return { providerFactory: () => { diff --git a/packages/react-pointcuts/docs/CHANGELOG.md b/packages/react-pointcuts/docs/CHANGELOG.md index 932854d..cd6be4f 100644 --- a/packages/react-pointcuts/docs/CHANGELOG.md +++ b/packages/react-pointcuts/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.2] - 2024-12-26 + +### Fixed + +- updated some errant JSDoc namespaces + ## [0.4.1] - 2024-12-17 ### Removed @@ -33,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - a `Map` of features (de-coupling from a webpack-specific data structure) - a [javascript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), rather than its `default` export (preparing for support of named exports) - updated to `react@18.3.1`, set minimum required react to `17` - - technically a breaking change, but `jsx-runtime` already introduced in [version 1.0.0](#100---2023-09-05)... so was already broken, oops. + - technically a breaking change, but `jsx-runtime` already introduced in [version 0.1.0](#010---2023-09-05)... so was already broken, oops. - moved package to `"type": "module"` and renamed commonJs exports to have `.cjs` extension to prevent `[ERR_REQUIRE_ESM]` errors in consumers that aren't `"type": "module"` ### Fixed diff --git a/packages/react-pointcuts/docs/README.md b/packages/react-pointcuts/docs/README.md index 8fb4694..92347dc 100644 --- a/packages/react-pointcuts/docs/README.md +++ b/packages/react-pointcuts/docs/README.md @@ -18,7 +18,7 @@ Both accept plugins, currently supporting a hook called during code activation ( ## Usage -See: [JSDoc output](https://asos.github.io/web-toggle-point/module-asos-web-toggle-point-react-pointcuts.html) +See: [JSDoc output](https://asos.github.io/web-toggle-point/module-web-toggle-point-react-pointcuts.html) > [!WARNING] > ### Use with React 17 diff --git a/packages/react-pointcuts/package.json b/packages/react-pointcuts/package.json index 62282e7..7ade338 100644 --- a/packages/react-pointcuts/package.json +++ b/packages/react-pointcuts/package.json @@ -1,7 +1,7 @@ { "name": "@asos/web-toggle-point-react-pointcuts", "description": "react pointcut code", - "version": "0.4.0", + "version": "0.4.2", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", diff --git a/packages/react-pointcuts/src/external.js b/packages/react-pointcuts/src/external.js index ef62d00..d3834a4 100644 --- a/packages/react-pointcuts/src/external.js +++ b/packages/react-pointcuts/src/external.js @@ -2,17 +2,6 @@ * Code expected in the host application * @external HostApplication */ -/** - * A factory for SDKs; should return an instance of asos-web-features when called with "features" - * @callback external:HostApplication.sdkInstanceProvider - * @async - * @type {Function} - * @param {string} sdkName Name of the SDK to access; will be passed "features" - * @returns {external:asos-web-features} - * @see SiteChrome SDK interface {@link https://asoscom.atlassian.net/wiki/spaces/WEB/pages/593592455/SCP+-+Interface+Definition#SDK-Instances|SDK Instances} - * @example - * const sdkInstance = await sdkInstanceProvider("features"); - */ /** * A delegate passed to log an error * @callback external:HostApplication.logError diff --git a/packages/react-pointcuts/src/getCodeSelectionPlugins.js b/packages/react-pointcuts/src/getCodeSelectionPlugins.js index 7dde7b2..4aa9b83 100644 --- a/packages/react-pointcuts/src/getCodeSelectionPlugins.js +++ b/packages/react-pointcuts/src/getCodeSelectionPlugins.js @@ -1,6 +1,6 @@ /** * A plugin for the point cuts package - * @typedef {object} module:toggle-point-react-pointcuts~plugin + * @typedef {object} module:web-toggle-point-react-pointcuts~plugin * @property {string} name plugin name, used as a prefix when creating {@link https://legacy.reactjs.org/docs/higher-order-components.html|React Higher-Order-Components} when toggling * @property {Function} onCodeSelected hook to be called when a code selection is made */ diff --git a/packages/react-pointcuts/src/index.js b/packages/react-pointcuts/src/index.js index fc91576..b31c5df 100644 --- a/packages/react-pointcuts/src/index.js +++ b/packages/react-pointcuts/src/index.js @@ -4,6 +4,6 @@ import "./external"; /** * Application code for creating a React {@link https://en.wikipedia.org/wiki/Pointcut|pointcut}. - * @module toggle-point-react-pointcuts + * @module web-toggle-point-react-pointcuts */ export { withTogglePointFactory, withToggledHookFactory }; diff --git a/packages/react-pointcuts/src/withTogglePointFactory/index.js b/packages/react-pointcuts/src/withTogglePointFactory/index.js index cd8e6f0..ecd92a2 100644 --- a/packages/react-pointcuts/src/withTogglePointFactory/index.js +++ b/packages/react-pointcuts/src/withTogglePointFactory/index.js @@ -7,17 +7,17 @@ import getCodeSelectionPlugins from "../getCodeSelectionPlugins"; {} /** * A factory function used to create a withTogglePoint React Higher-Order-Component. - * @memberof module:toggle-point-react-pointcuts + * @memberof module:web-toggle-point-react-pointcuts * @inner * @function * @param {object} params parameters * @param {function} params.getActiveFeatures a method to get active features. Called honouring the rules of hooks. * @param {external:HostApplication.logError} params.logError a method that logs errors * @param {string} [params.variantKey=bucket] A key use to identify a variant from the features data structure. Remaining members of the feature will be passed to the variant as props. - * @param {Array} [params.plugins] plugins to be used when toggling + * @param {Array} [params.plugins] plugins to be used when toggling * Will be used when a toggled component throws an error that can be caught by an {@link https://reactjs.org/docs/error-boundaries.html|ErrorBoundary}. * When errors are caught, the control/base code will be used as the fallback component. - * @returns {module:toggle-point-react-pointcuts.withTogglePoint} withTogglePoint React Higher-Order-Component. + * @returns {module:web-toggle-point-react-pointcuts.withTogglePoint} withTogglePoint React Higher-Order-Component. * @example * const withTogglePoint = withTogglePointFactory({ * getActiveFeatures, @@ -37,7 +37,7 @@ const withTogglePointFactory = ({ /** * A React Higher-Order-Component that wraps a base / control component and swaps in a variant when deemed appropriate by a context * @function withTogglePoint - * @memberof module:toggle-point-react-pointcuts + * @memberof module:web-toggle-point-react-pointcuts * @param {ReactComponentModuleNamespaceObject} controlModule The control / base module * @param {external:React.Component} controlModule.default The control react component * @param {Map} featuresMap A map of features and their variants, with features as top-level keys and variants as nested keys with modules as the values. diff --git a/packages/react-pointcuts/src/withToggledHookFactory/index.js b/packages/react-pointcuts/src/withToggledHookFactory/index.js index 61baeb7..13c7413 100644 --- a/packages/react-pointcuts/src/withToggledHookFactory/index.js +++ b/packages/react-pointcuts/src/withToggledHookFactory/index.js @@ -6,13 +6,13 @@ import getCodeSelectionPlugins from "../getCodeSelectionPlugins"; {} /** * A factory function used to create a withToggledHook React hook, wrapping an existing hook/function. - * @memberof module:toggle-point-react-pointcuts + * @memberof module:web-toggle-point-react-pointcuts * @inner * @function * @param {object} params parameters * @param {function} params.getActiveFeatures a method to get active features, which is called honouring the rules of hooks. - * @param {Array} [params.plugins] plugins to be used when toggling - * @returns {module:toggle-point-react-pointcuts.withToggledHook} withToggledHook hook function, use to wrap a function (either a hook itself, or a function that must be called wherever a hook can...). + * @param {Array} [params.plugins] plugins to be used when toggling + * @returns {module:web-toggle-point-react-pointcuts.withToggledHook} withToggledHook hook function, use to wrap a function (either a hook itself, or a function that must be called wherever a hook can...). * @example * const getActiveFeatures = () => useContext(myContext); * const withToggledHook = withToggledHookFactory({ @@ -28,7 +28,7 @@ const withToggledHookFactory = ({ getActiveFeatures, plugins = [] }) => { /** * A React hook that wraps a base / control function or hook and swaps in a variant when deemed appropriate by a context * @function withToggledHook - * @memberof module:toggle-point-react-pointcuts + * @memberof module:web-toggle-point-react-pointcuts * @param {ReactHookModuleNamespaceObject} controlModule The control / base module * @param {(external:React.Hook|function)} controlModule.default The control react hook or function. * @param {Map} featuresMap A map of features and their variants, with features as top-level keys and variants as nested keys with modules as the values. diff --git a/packages/ssr/docs/CHANGELOG.md b/packages/ssr/docs/CHANGELOG.md index 75ca4ea..31ed972 100644 --- a/packages/ssr/docs/CHANGELOG.md +++ b/packages/ssr/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.1] - 2024-12-26 + +### Fixed + +- updated some errant JSDoc namespaces + ## [0.2.0] - 2024-12-17 ### Removed @@ -50,7 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - updated to latest `@testing-library/react` to remove errant warning about import of `act` - updated to `react@18.3.1`, set minimum required react to `17` - - technically a breaking change, but `jsx-runtime` already introduced in [version 1.0.0](#100---2023-09-05)... so was already broken, oops. + - technically a breaking change, but `jsx-runtime` already introduced in [version 0.1.0](#010---2023-09-05)... so was already broken, oops. - renamed commonJs exports to have `.cjs` extension to prevent `[ERR_REQUIRE_ESM]` errors in consumers that aren't `"type": "module"` ## [0.1.2] - 2024-12-06 diff --git a/packages/ssr/docs/README.md b/packages/ssr/docs/README.md index 78845c2..54873d8 100644 --- a/packages/ssr/docs/README.md +++ b/packages/ssr/docs/README.md @@ -28,7 +28,7 @@ For the browser: ## Usage -See: [JSDoc output](https://asos.github.io/web-toggle-point/module-asos-web-toggle-point-ssr.html) +See: [JSDoc output](https://asos.github.io/web-toggle-point/module-web-toggle-point-ssr.html) > [!WARNING] > ### Use with React 17 diff --git a/packages/ssr/package.json b/packages/ssr/package.json index 2a6578d..10b2ff7 100644 --- a/packages/ssr/package.json +++ b/packages/ssr/package.json @@ -1,7 +1,7 @@ { "name": "@asos/web-toggle-point-ssr", "description": "toggle point server side rendering code", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", diff --git a/packages/ssr/src/external.js b/packages/ssr/src/external.js index 3603746..68c0153 100644 --- a/packages/ssr/src/external.js +++ b/packages/ssr/src/external.js @@ -2,17 +2,6 @@ * Code expected in the host application * @external HostApplication */ -/** - * A factory for SDKs; should return an instance of asos-web-features when called with "features" - * @callback external:HostApplication.sdkInstanceProvider - * @async - * @type {Function} - * @param {string} sdkName Name of the SDK to access; will be passed "features" - * @returns {external:asos-web-features} - * @see SiteChrome SDK interface {@link https://asoscom.atlassian.net/wiki/spaces/WEB/pages/593592455/SCP+-+Interface+Definition#SDK-Instances|SDK Instances} - * @example - * const sdkInstance = await sdkInstanceProvider("features"); - */ /** * A delegate passed to log a warning * @callback external:HostApplication.logWarning diff --git a/packages/ssr/src/index.js b/packages/ssr/src/index.js index cbba6c8..e4d6750 100644 --- a/packages/ssr/src/index.js +++ b/packages/ssr/src/index.js @@ -3,7 +3,7 @@ import withJsonIsomorphism from "./withJsonIsomorphism"; import "./external"; /** - * Server Side Rendering code for Isomorphic React applications - * @module asos-web-toggle-point-ssr + * Server Side Rendering code for isomorphic / universal applications + * @module web-toggle-point-ssr */ export { withJsonIsomorphism, serializationFactory }; diff --git a/packages/ssr/src/serializationFactory/index.js b/packages/ssr/src/serializationFactory/index.js index 53ab300..c3e6794 100644 --- a/packages/ssr/src/serializationFactory/index.js +++ b/packages/ssr/src/serializationFactory/index.js @@ -5,16 +5,16 @@ import parse from "html-react-parser"; {} /** * A factory for creating a serialization object that has methods for serializing and deserializing JSON data in server-rendered web applications. - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @inner * @function - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @inner * @function * @param {object} params parameters * @param {string} params.id The id attribute of the backing application/json script. * @param {external:HostApplication.logWarning} params.logWarning A method that logs warnings; will be used when malformed JSON is found in the backing store when deserialize on the client, which should only be possible if processed in a system downstream from the origin. - * @returns {module:asos-web-toggle-point-ssr.serialization} Some serialization / deserialization methods + * @returns {module:web-toggle-point-ssr.serialization} Some serialization / deserialization methods * @example * const logWarning = (warning) => console.log(warning); * const id = "app_features"; @@ -23,33 +23,33 @@ import parse from "html-react-parser"; const serializationFactory = ({ id, logWarning }) => /** * @typedef {function} getScriptMarkup - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @param {object} params parameters * @param {object} params.content The JSON content to be serialized. */ /** * @typedef {function} getScriptReactElement - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @param {object} params parameters * @param {object} params.content The JSON content to be serialized. */ /** * @typedef {function} getJSONFromScript - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @returns {object} The JSON content of the script element. */ /** * An object containing methods for serializing and deserializing JSON data in server-rendered web applications. * @typedef {object} serialization - * @memberof module:asos-web-toggle-point-ssr - * @property {module:asos-web-toggle-point-ssr.getScriptMarkup} getScriptMarkup Gets a string containing markup for a type="application/json" script element with the specified content. - * @property {module:asos-web-toggle-point-ssr.getScriptReactElement} getScriptReactElement - Gets a React element for a type="application/json" script element with the specified content. - * @property {module:asos-web-toggle-point-ssr.getJSONFromScript} getJSONFromScript - Returns the JSON content of the script element. + * @memberof module:web-toggle-point-ssr + * @property {module:web-toggle-point-ssr.getScriptMarkup} getScriptMarkup Gets a string containing markup for a type="application/json" script element with the specified content. + * @property {module:web-toggle-point-ssr.getScriptReactElement} getScriptReactElement - Gets a React element for a type="application/json" script element with the specified content. + * @property {module:web-toggle-point-ssr.getJSONFromScript} getJSONFromScript - Returns the JSON content of the script element. */ ({ /** - * @memberof module:asos-web-toggle-point-ssr.serialization + * @memberof module:web-toggle-point-ssr.serialization * @param {object} content The JSON content to be serialized. * @returns {string} A string containing markup for a type="application/json" script element with the specified content. */ diff --git a/packages/ssr/src/withJsonIsomorphism/index.js b/packages/ssr/src/withJsonIsomorphism/index.js index b68c691..8559f37 100644 --- a/packages/ssr/src/withJsonIsomorphism/index.js +++ b/packages/ssr/src/withJsonIsomorphism/index.js @@ -8,7 +8,7 @@ import { useState, useEffect } from "react"; * which are then realised into a prop when first hydrating on the client. It will be reactive to subsequent non-`undefined` prop values, * for that prop. * The package "browser" export includes the code to read the script, omitted from the "import" / "require" export (server package). - * @memberof module:asos-web-toggle-point-ssr + * @memberof module:web-toggle-point-ssr * @inner * @function * @param {external:React.Component} WrappedComponent The React component that will receive the props. diff --git a/packages/webpack/docs/CHANGELOG.md b/packages/webpack/docs/CHANGELOG.md index 5102394..9467746 100644 --- a/packages/webpack/docs/CHANGELOG.md +++ b/packages/webpack/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.3] - 2024-12-26 + +### Fixed + +- updated some errant JSDoc namespaces + ## [0.7.2] - 2024-12-17 ### Removed diff --git a/packages/webpack/docs/README.md b/packages/webpack/docs/README.md index 823c534..f4c7b1d 100644 --- a/packages/webpack/docs/README.md +++ b/packages/webpack/docs/README.md @@ -20,7 +20,7 @@ The join points are configured using a [glob](https://en.wikipedia.org/wiki/Glob ### Configuration -See [JSDoc output](https://asos.github.io/web-toggle-point/module-asos-web-toggle-point-webpack.html) +See [JSDoc output](https://asos.github.io/web-toggle-point/module-web-toggle-point-webpack.html) Different code paths may have different toggling needs, and may want a toggle point applied in differing ways. Independent point cuts should be configured for each different: diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 38fbc45..ec17f81 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,7 +1,7 @@ { "name": "@asos/web-toggle-point-webpack", "description": "toggle point webpack plugin", - "version": "0.7.2", + "version": "0.7.3", "license": "MIT", "type": "module", "main": "./lib/main.cjs", diff --git a/packages/webpack/src/index.js b/packages/webpack/src/index.js index a99fcdc..a11c1e9 100644 --- a/packages/webpack/src/index.js +++ b/packages/webpack/src/index.js @@ -2,6 +2,6 @@ import "./external.js"; /** * Webpack code for injecting toggle points - * @module toggle-point-webpack + * @module web-toggle-point-webpack */ export { TogglePointInjection } from "./plugins"; diff --git a/packages/webpack/src/plugins/togglePointInjection/index.js b/packages/webpack/src/plugins/togglePointInjection/index.js index df98970..0148828 100644 --- a/packages/webpack/src/plugins/togglePointInjection/index.js +++ b/packages/webpack/src/plugins/togglePointInjection/index.js @@ -9,7 +9,7 @@ import schema from "./schema.json"; /** * Toggle Point Injection Plugin - * @memberof module:toggle-point-webpack + * @memberof module:web-toggle-point-webpack * @inner */ class TogglePointInjection { From 1f0cb29d36b158f19c1301eba2c122c0810c146b Mon Sep 17 00:00:00 2001 From: Tom Pereira <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:18:52 +0000 Subject: [PATCH 03/24] [26] Fix public/scoped package publishing (#27) * update workflows * version * typo * update chromium linux snaps * versions for serve update * package.json repository field * update root package.lock * bugs & directories/doc fields * fix changelog --------- Co-authored-by: Tom Pereira --- .github/actions/publish/publish.sh | 2 +- .github/workflows/release.yaml | 2 ++ docs/CHANGELOG.md | 6 ++++++ examples/serve/docs/CHANGELOG.md | 7 +++++++ examples/serve/package.json | 2 +- .../-screenshots-control-chromium-linux.png | Bin 1515 -> 1281 bytes ...enshots-st-patricks-day-chromium-linux.png | Bin 3354 -> 3079 bytes package-lock.json | 14 +++++++------- package.json | 2 +- packages/features/docs/CHANGELOG.md | 6 ++++++ packages/features/package.json | 13 ++++++++++++- packages/react-pointcuts/docs/CHANGELOG.md | 6 ++++++ packages/react-pointcuts/package.json | 13 ++++++++++++- packages/ssr/docs/CHANGELOG.md | 6 ++++++ packages/ssr/package.json | 13 ++++++++++++- packages/webpack/docs/CHANGELOG.md | 6 ++++++ packages/webpack/package.json | 13 ++++++++++++- 17 files changed, 97 insertions(+), 14 deletions(-) diff --git a/.github/actions/publish/publish.sh b/.github/actions/publish/publish.sh index cd06cdf..cd8920a 100755 --- a/.github/actions/publish/publish.sh +++ b/.github/actions/publish/publish.sh @@ -1,2 +1,2 @@ TAG=$([ "$PRE_RELEASE" == "true" ] && echo "--tag=pre-release ") -npm publish $TAG--workspace=$WORKSPACE 2> publish_stderr_digest.log +npm publish --access public $TAG--workspace=$WORKSPACE 2> publish_stderr_digest.log diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eb97d40..ef7b596 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -219,3 +219,5 @@ jobs: name: ${{ matrix.package.name }} version: ${{ steps.newVersion.outputs.version }} is-pre-release: ${{ env.IS_PRE_RELEASE }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 532c7d8..42e9399 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,12 @@ N.B. See changelogs for individual packages, where most change will occur: This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). +## [0.10.3] - 2025-02-27 + +### Fixed + +- GHA pipelines for publishing to public/scoped NPM repository + ## [0.10.2] - 2024-12-26 ### Fixed diff --git a/examples/serve/docs/CHANGELOG.md b/examples/serve/docs/CHANGELOG.md index 126a3c8..9f2b321 100644 --- a/examples/serve/docs/CHANGELOG.md +++ b/examples/serve/docs/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.3] - 2025-02-27 + +### Changed + +- updated some linux playwright snapshots + - no code changes, so this must be a change in linux chromium. Assets look identical to eye, so presumably need to relax the fuzziness. + ## [0.2.2] - 2024-12-17 ### Removed diff --git a/examples/serve/package.json b/examples/serve/package.json index 945644b..20a3f5d 100644 --- a/examples/serve/package.json +++ b/examples/serve/package.json @@ -1,6 +1,6 @@ { "name": "web-toggle-point-serve-example", - "version": "0.2.0", + "version": "0.2.3", "type": "module", "private": true, "scripts": { diff --git a/examples/serve/src/fixtures/event/playwright.spec.ts-snapshots/-screenshots-control-chromium-linux.png b/examples/serve/src/fixtures/event/playwright.spec.ts-snapshots/-screenshots-control-chromium-linux.png index 6615aa1a81dce531b97b8f2d111a015ab6a08e19..f1aa0ebed6c0d579a89a296353976c95a38abd46 100644 GIT binary patch delta 1249 zcmV<71RneA3xNudFn)my&Yb+>UG`%YU6`?^f*U%c*q61R@!uK()RUrEOE zp4{I7pq}kA#OdlH001CSx2CS*gd+OMdUO6JcDvo8#RP%DFF zbljMgS+zGGRDX&b%W_hAuu78Epe%8P0w+~Qo8*RjZM2FWr8wAZIz_%RPfjND3a|Ep zy8&lqR_!fjjgr6?3Y<`C&i1ESHigqcg~swc>zA#25mHW(O@Xs@$!N|Nog!D6-x6oi zFeIKWu$*Kx=fTaAuKMzf6d9BRyWMUVj10cOtCh}Vv44q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Us%1VQYX_J(bq0a~3_5Bk?et`EHpp;&mj{C_l`%a7(qBYyk$FIYD25Qpi=qH)Zy(1$*}gD^X>v6Pe)Gsfex zoF&ReL4Goh(tI4pm|>w0eRv09c4C|PL;?UUp?=a(=*b&F@8o^14}JJM!o0-(AFhOd V$k~JKp#T5?07*qoL Date: Thu, 6 Mar 2025 14:23:30 +0000 Subject: [PATCH 04/24] fix registry url etc (#34) Co-authored-by: Tom Pereira --- .github/actions/publish/action.yaml | 2 ++ docs/CHANGELOG.md | 6 ++++++ package.json | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/actions/publish/action.yaml b/.github/actions/publish/action.yaml index bb3659c..2106e92 100644 --- a/.github/actions/publish/action.yaml +++ b/.github/actions/publish/action.yaml @@ -21,6 +21,8 @@ runs: - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + registry-url: https://registry.npmjs.org/ + always-auth: true cache: npm - name: Install diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 42e9399..bfcd51b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,12 @@ N.B. See changelogs for individual packages, where most change will occur: This log covers the [monorepo](https://en.wikipedia.org/wiki/Monorepo). +## [0.10.4] - 2025-03-06 + +### Fixed + +- Ensured that the registry is explicitly set, to ensure that [`@actions/setup-node`](https://github.com/actions/setup-node) honours the `NODE_AUTH_TOKEN` + ## [0.10.3] - 2025-02-27 ### Fixed diff --git a/package.json b/package.json index a2992c6..540f361 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@asos/web-toggle-point", - "version": "0.10.3", + "version": "0.10.4", "repository": "git@github.com:asos/web-toggle-point.git", "homepage": "https://asos.github.io/web-toggle-point/", "license": "MIT", From da6ccf13059dba9f769f7770c764400bd986a87e Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Sun, 6 Jul 2025 18:22:07 +0100 Subject: [PATCH 05/24] named exports of the features package --- examples/express/docs/CHANGELOG.md | 6 ++ examples/express/package.json | 2 +- .../src/routes/animals/featuresStore.js | 3 +- .../src/routes/config/featuresStore.js | 3 +- examples/next/docs/CHANGELOG.md | 6 ++ examples/next/package.json | 2 +- .../app/fixtures/experiments/featuresStore.ts | 2 +- examples/serve/docs/CHANGELOG.md | 6 ++ examples/serve/package.json | 2 +- .../src/fixtures/audience/__featuresStore.js | 3 +- .../src/fixtures/config/__featuresStore.js | 3 +- .../src/fixtures/event/__featuresStore.js | 3 +- .../fixtures/translation/__featuresStore.js | 3 +- package-lock.json | 91 +++++++++++++++++-- packages/features/build/rollup.mjs | 36 ++++---- packages/features/docs/CHANGELOG.md | 6 ++ packages/features/package.json | 28 +++--- packages/features/src/browser.js | 4 - packages/features/src/node.js | 5 - .../globalFeaturesStoreFactory.js} | 0 .../globalFeaturesStoreFactory.test.js} | 2 +- .../nodeRequestScopedFeaturesStoreFactory.js} | 6 +- ...RequestScopedFeaturesStoreFactory.test.js} | 6 +- .../reactContextFeaturesStoreFactory.js} | 0 .../reactContextFeaturesStoreFactory.test.js} | 6 +- ...BackedReactContextFeaturesStoreFactory.js} | 2 +- ...dReactContextFeaturesStoreFactory.test.js} | 14 +-- 27 files changed, 171 insertions(+), 79 deletions(-) delete mode 100644 packages/features/src/browser.js delete mode 100644 packages/features/src/node.js rename packages/features/src/{global/store.js => storeFactories/globalFeaturesStoreFactory.js} (100%) rename packages/features/src/{global/store.test.js => storeFactories/globalFeaturesStoreFactory.test.js} (94%) rename packages/features/src/{nodeRequestScoped/store.js => storeFactories/nodeRequestScopedFeaturesStoreFactory.js} (88%) rename packages/features/src/{nodeRequestScoped/store.test.js => storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js} (87%) rename packages/features/src/{reactContext/store.js => storeFactories/reactContextFeaturesStoreFactory.js} (100%) rename packages/features/src/{reactContext/store.test.js => storeFactories/reactContextFeaturesStoreFactory.test.js} (84%) rename packages/features/src/{ssrBackedReactContext/store.js => storeFactories/ssrBackedReactContextFeaturesStoreFactory.js} (95%) rename packages/features/src/{ssrBackedReactContext/store.test.js => storeFactories/ssrBackedReactContextFeaturesStoreFactory.test.js} (89%) diff --git a/examples/express/docs/CHANGELOG.md b/examples/express/docs/CHANGELOG.md index 6ac4195..6cd0fb0 100644 --- a/examples/express/docs/CHANGELOG.md +++ b/examples/express/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.4] - 2025-07-06 + +### Changed + +- Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-06)) + ## [0.2.3] - 2024-12-24 ### Changed diff --git a/examples/express/package.json b/examples/express/package.json index 995407b..75ecd27 100644 --- a/examples/express/package.json +++ b/examples/express/package.json @@ -1,6 +1,6 @@ { "name": "web-toggle-point-express-example", - "version": "0.2.3", + "version": "0.2.4", "type": "module", "engines": { "node": ">=20.6.0" diff --git a/examples/express/src/routes/animals/featuresStore.js b/examples/express/src/routes/animals/featuresStore.js index e446d88..a108fc6 100644 --- a/examples/express/src/routes/animals/featuresStore.js +++ b/examples/express/src/routes/animals/featuresStore.js @@ -1,4 +1,5 @@ -import { nodeRequestScopedStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/nodeRequestScopedFeaturesStoreFactory"; const featuresStore = featuresStoreFactory(); diff --git a/examples/express/src/routes/config/featuresStore.js b/examples/express/src/routes/config/featuresStore.js index 89fc5d4..0a36142 100644 --- a/examples/express/src/routes/config/featuresStore.js +++ b/examples/express/src/routes/config/featuresStore.js @@ -1,4 +1,5 @@ -import { ssrBackedReactContextFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/ssrBackedReactContextFeaturesStoreFactory"; const featuresStore = featuresStoreFactory({ name: "config", diff --git a/examples/next/docs/CHANGELOG.md b/examples/next/docs/CHANGELOG.md index 8f4e287..be75a2f 100644 --- a/examples/next/docs/CHANGELOG.md +++ b/examples/next/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.3] - 2025-07-06 + +### Changed + +- Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-06)) + ## [0.2.2] - 2024-12-24 ### Fixed diff --git a/examples/next/package.json b/examples/next/package.json index b7478e4..60a4744 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -1,6 +1,6 @@ { "name": "web-toggle-point-next-example", - "version": "0.2.2", + "version": "0.2.3", "private": true, "type": "module", "scripts": { diff --git a/examples/next/src/app/fixtures/experiments/featuresStore.ts b/examples/next/src/app/fixtures/experiments/featuresStore.ts index 622d5fb..9a58eb5 100644 --- a/examples/next/src/app/fixtures/experiments/featuresStore.ts +++ b/examples/next/src/app/fixtures/experiments/featuresStore.ts @@ -1,6 +1,6 @@ "use client"; -import { reactContextFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/reactContextFeaturesStoreFactory"; const reactContextStore = featuresStoreFactory({ name: "Experiments" diff --git a/examples/serve/docs/CHANGELOG.md b/examples/serve/docs/CHANGELOG.md index 9f2b321..ed67ef4 100644 --- a/examples/serve/docs/CHANGELOG.md +++ b/examples/serve/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.4] - 2025-07-06 + +### Changed + +- Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-06)) + ## [0.2.3] - 2025-02-27 ### Changed diff --git a/examples/serve/package.json b/examples/serve/package.json index 20a3f5d..c46e176 100644 --- a/examples/serve/package.json +++ b/examples/serve/package.json @@ -1,6 +1,6 @@ { "name": "web-toggle-point-serve-example", - "version": "0.2.3", + "version": "0.2.4", "type": "module", "private": true, "scripts": { diff --git a/examples/serve/src/fixtures/audience/__featuresStore.js b/examples/serve/src/fixtures/audience/__featuresStore.js index 515ddd0..d673a89 100644 --- a/examples/serve/src/fixtures/audience/__featuresStore.js +++ b/examples/serve/src/fixtures/audience/__featuresStore.js @@ -1,4 +1,5 @@ -import { globalFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/globalFeaturesStoreFactory"; const featuresStore = featuresStoreFactory(); diff --git a/examples/serve/src/fixtures/config/__featuresStore.js b/examples/serve/src/fixtures/config/__featuresStore.js index 8654560..21fbea4 100644 --- a/examples/serve/src/fixtures/config/__featuresStore.js +++ b/examples/serve/src/fixtures/config/__featuresStore.js @@ -1,4 +1,5 @@ -import { globalFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/globalFeaturesStoreFactory"; const featuresStore = featuresStoreFactory(); diff --git a/examples/serve/src/fixtures/event/__featuresStore.js b/examples/serve/src/fixtures/event/__featuresStore.js index 0c3bfa6..cfd1208 100644 --- a/examples/serve/src/fixtures/event/__featuresStore.js +++ b/examples/serve/src/fixtures/event/__featuresStore.js @@ -1,4 +1,5 @@ -import { globalFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/globalFeaturesStoreFactory"; const featuresStore = featuresStoreFactory(); diff --git a/examples/serve/src/fixtures/translation/__featuresStore.js b/examples/serve/src/fixtures/translation/__featuresStore.js index d2c00a1..2098e43 100644 --- a/examples/serve/src/fixtures/translation/__featuresStore.js +++ b/examples/serve/src/fixtures/translation/__featuresStore.js @@ -1,4 +1,5 @@ -import { globalFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features"; +// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/1810 +import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/globalFeaturesStoreFactory"; const featuresStore = featuresStoreFactory(); diff --git a/package-lock.json b/package-lock.json index 1601923..14b6f2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asos/web-toggle-point", - "version": "0.10.3", + "version": "0.10.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asos/web-toggle-point", - "version": "0.10.3", + "version": "0.10.4", "license": "MIT", "workspaces": [ "packages/features", @@ -57,7 +57,7 @@ }, "examples/express": { "name": "web-toggle-point-express-example", - "version": "0.2.3", + "version": "0.2.4", "dependencies": { "@asos/web-toggle-point-features": "file:../../packages/features", "@asos/web-toggle-point-react-pointcuts": "file:../../packages/react-pointcuts", @@ -89,7 +89,7 @@ }, "examples/next": { "name": "web-toggle-point-next-example", - "version": "0.2.2", + "version": "0.2.3", "dependencies": { "@asos/web-toggle-point-features": "file:../../packages/features", "@asos/web-toggle-point-react-pointcuts": "file:../../packages/react-pointcuts", @@ -116,7 +116,7 @@ }, "examples/serve": { "name": "web-toggle-point-serve-example", - "version": "0.2.3", + "version": "0.2.4", "dependencies": { "@asos/web-toggle-point-features": "file:../../packages/features", "@asos/web-toggle-point-webpack": "file:../../packages/webpack", @@ -4206,6 +4206,33 @@ "node": ">=18" } }, + "node_modules/@reduxjs/toolkit": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.8.2.tgz", + "integrity": "sha512-MYlOhQ0sLdw4ud48FoC5w0dH9VfWQjtCjreKwYTT3l+r427qYC5Y8PihNutepr8XrNaBUDQo9khWUwQxZaqt5A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^10.0.3", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, "node_modules/@rollup/plugin-babel": { "version": "6.0.4", "dev": true, @@ -4437,6 +4464,20 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "license": "MIT", + "peer": true + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT", + "peer": true + }, "node_modules/@stylistic/eslint-plugin-js": { "version": "2.12.1", "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-2.12.1.tgz", @@ -10292,6 +10333,17 @@ "node": ">= 4" } }, + "node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "license": "MIT", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/import-fresh": { "version": "3.3.0", "license": "MIT", @@ -17008,6 +17060,23 @@ "node": ">=8" } }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT", + "peer": true + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "redux": "^5.0.0" + } + }, "node_modules/reflect.getprototypeof": { "version": "1.0.9", "license": "MIT", @@ -17274,6 +17343,13 @@ "lodash": "^4.17.21" } }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT", + "peer": true + }, "node_modules/resolve": { "version": "1.22.10", "license": "MIT", @@ -20346,7 +20422,7 @@ }, "packages/features": { "name": "@asos/web-toggle-point-features", - "version": "0.3.2", + "version": "0.4.0", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0" @@ -20387,9 +20463,6 @@ "@asos/web-toggle-point-ssr": { "optional": true }, - "@reduxjs/toolkit": { - "optional": true - }, "prop-types": { "optional": true }, diff --git a/packages/features/build/rollup.mjs b/packages/features/build/rollup.mjs index 5185c31..8e78412 100644 --- a/packages/features/build/rollup.mjs +++ b/packages/features/build/rollup.mjs @@ -1,37 +1,33 @@ -import pkg from "../package.json" with { type: "json" }; import babel from "@rollup/plugin-babel"; import resolve from "@rollup/plugin-node-resolve"; import external from "rollup-plugin-auto-external"; import commonjs from "@rollup/plugin-commonjs"; import terser from "@rollup/plugin-terser"; import keepExternalComments from "./keepExternalComments.js"; +import { readdir } from "node:fs/promises"; + +export default async ({ config_isBrowser }) => { + const isBrowser = JSON.parse(config_isBrowser); + + const browserPrefix = isBrowser ? "browser." : ""; + + const input = (await readdir("./src/storeFactories")) + .filter((file) => !file.endsWith(".test.js")) + .filter((file) => !(file.startsWith("node") && isBrowser)) + .map((factory) => `./src/storeFactories/${factory}`); -export default ({ config_isClient }) => { - const CLIENT = JSON.parse(config_isClient); - const [input, esOutputFile, cjsOutputFile, extraPlugins] = { - false: [ - "./src/node.js", - pkg.exports.node.import, - pkg.exports.node.require, - [] - ], - true: [ - "./src/browser.js", - pkg.exports.default.import, - pkg.exports.default.require, - [terser()] - ] - }[CLIENT]; return { input, output: [ { - file: esOutputFile, + dir: "lib/", + entryFileNames: `[name].${browserPrefix}js`, format: "es", sourcemap: true }, { - file: cjsOutputFile, + dir: "lib/", + entryFileNames: `[name].${browserPrefix}es5.cjs`, format: "cjs", sourcemap: true } @@ -48,7 +44,7 @@ export default ({ config_isClient }) => { }), commonjs(), external(), - ...extraPlugins + isBrowser ? [terser()] : [] ], preserveSymlinks: true }; diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index c7b7a37..37dcc33 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.0] - 2025-07-06 + +### Fixed + +- Moved to named exports, to ensure that the "ssr" package is not a dependency, unless importing the `ssrBackedReactContextFeaturesStoreFactory` + ## [0.3.2] - 2025-03-03 ### Changed diff --git a/packages/features/package.json b/packages/features/package.json index f5e2477..a952a90 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -1,19 +1,22 @@ { "name": "@asos/web-toggle-point-features", "description": "toggle point features code", - "version": "0.3.2", + "version": "0.4.0", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", "sideEffects": false, "exports": { - "node": { - "import": "./lib/main.js", - "require": "./lib/main.es5.cjs" - }, - "default": { - "import": "./lib/browser.js", - "require": "./lib/browser.es5.cjs" + ".": null, + "./storeFactories/*": { + "node": { + "import": "./lib/*.js", + "require": "./lib/*.es5.cjs" + }, + "default": { + "import": "./lib/*.browser.js", + "require": "./lib/*.browser.es5.cjs" + } } }, "repository": { @@ -27,12 +30,12 @@ "directories": { "doc": "docs" }, - "scripts": { + "scripts": { "build-dependencies": "path-exists ../../packages/ssr/lib || npm run --prefix ../../packages/ssr build", "prebuild": "npm run build-dependencies", "build": "npm run clean && npm run build:browser && npm run build:server", - "build:browser": "cross-env BABEL_ENV=browser rollup -c build/rollup.mjs --config_isClient true", - "build:server": "rollup -c build/rollup.mjs --config_isClient false", + "build:browser": "cross-env BABEL_ENV=browser rollup -c build/rollup.mjs --config_isBrowser true", + "build:server": "rollup -c build/rollup.mjs --config_isBrowser false", "prepublishOnly": "npm run build", "clean": "rimraf ./lib", "docs": "rimraf ./docs/**/*.html && jsdoc -c ../jsdoc.conf.js", @@ -81,9 +84,6 @@ "@asos/web-toggle-point-ssr": { "optional": true }, - "@reduxjs/toolkit": { - "optional": true - }, "prop-types": { "optional": true }, diff --git a/packages/features/src/browser.js b/packages/features/src/browser.js deleted file mode 100644 index 972b8fa..0000000 --- a/packages/features/src/browser.js +++ /dev/null @@ -1,4 +0,0 @@ -import "./global"; -export { default as globalFeaturesStoreFactory } from "./global/store"; -export { default as reactContextFeaturesStoreFactory } from "./reactContext/store"; -export { default as ssrBackedReactContextFeaturesStoreFactory } from "./ssrBackedReactContext/store"; diff --git a/packages/features/src/node.js b/packages/features/src/node.js deleted file mode 100644 index c4489a3..0000000 --- a/packages/features/src/node.js +++ /dev/null @@ -1,5 +0,0 @@ -import "./global"; -export { default as globalFeaturesStoreFactory } from "./global/store"; -export { default as nodeRequestScopedStoreFactory } from "./nodeRequestScoped/store"; -export { default as reactContextFeaturesStoreFactory } from "./reactContext/store"; -export { default as ssrBackedReactContextFeaturesStoreFactory } from "./ssrBackedReactContext/store"; diff --git a/packages/features/src/global/store.js b/packages/features/src/storeFactories/globalFeaturesStoreFactory.js similarity index 100% rename from packages/features/src/global/store.js rename to packages/features/src/storeFactories/globalFeaturesStoreFactory.js diff --git a/packages/features/src/global/store.test.js b/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js similarity index 94% rename from packages/features/src/global/store.test.js rename to packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js index 67cbda6..9b63015 100644 --- a/packages/features/src/global/store.test.js +++ b/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js @@ -1,4 +1,4 @@ -import globalFeaturesStoreFactory from "./store"; +import globalFeaturesStoreFactory from "./globalFeaturesStoreFactory"; describe("globalFeaturesStoreFactory", () => { let featuresStoreFactory; diff --git a/packages/features/src/nodeRequestScoped/store.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js similarity index 88% rename from packages/features/src/nodeRequestScoped/store.js rename to packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js index c2232df..42eb523 100644 --- a/packages/features/src/nodeRequestScoped/store.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js @@ -7,11 +7,11 @@ import { AsyncLocalStorage } from "async_hooks"; * @memberof module:web-toggle-point-features * @returns {module:web-toggle-point-features.requestScopedFeaturesStore} A store for features, scoped for the current request. */ -const requestScopedFeaturesStoreFactory = () => { +const nodeRequestScopedFeaturesStoreFactory = () => { const store = new AsyncLocalStorage(); /** - * @name requestScopedFeaturesStore + * @name nodeRequestScopedFeaturesStore * @memberof module:web-toggle-point-features * @implements module:web-toggle-point-features.FeaturesStore * @implements module:web-toggle-point-features.SingletonFeaturesStore @@ -30,4 +30,4 @@ const requestScopedFeaturesStoreFactory = () => { }; }; -export default requestScopedFeaturesStoreFactory; +export default nodeRequestScopedFeaturesStoreFactory; diff --git a/packages/features/src/nodeRequestScoped/store.test.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js similarity index 87% rename from packages/features/src/nodeRequestScoped/store.test.js rename to packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js index ed50279..d554fee 100644 --- a/packages/features/src/nodeRequestScoped/store.test.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js @@ -1,4 +1,4 @@ -import requestScopedStoreFactory from "./store"; +import nodeRequestScopedFeaturesStoreFactory from "./nodeRequestScopedFeaturesStoreFactory"; import { AsyncLocalStorage } from "async_hooks"; jest.mock("async_hooks", () => ({ @@ -8,11 +8,11 @@ jest.mock("async_hooks", () => ({ })) })); -describe("store", () => { +describe("nodeRequestScopedFeaturesStoreFactory", () => { let requestScopedStore; beforeEach(() => { - requestScopedStore = requestScopedStoreFactory(); + requestScopedStore = nodeRequestScopedFeaturesStoreFactory(); }); it("should create an AsyncLocalStorage store", () => { diff --git a/packages/features/src/reactContext/store.js b/packages/features/src/storeFactories/reactContextFeaturesStoreFactory.js similarity index 100% rename from packages/features/src/reactContext/store.js rename to packages/features/src/storeFactories/reactContextFeaturesStoreFactory.js diff --git a/packages/features/src/reactContext/store.test.js b/packages/features/src/storeFactories/reactContextFeaturesStoreFactory.test.js similarity index 84% rename from packages/features/src/reactContext/store.test.js rename to packages/features/src/storeFactories/reactContextFeaturesStoreFactory.test.js index f5e0344..e968a1e 100644 --- a/packages/features/src/reactContext/store.test.js +++ b/packages/features/src/storeFactories/reactContextFeaturesStoreFactory.test.js @@ -1,12 +1,12 @@ -import reactContextStoreFactory from "./store"; +import reactContextFeaturesStoreFactory from "./reactContextFeaturesStoreFactory"; import { render, screen } from "@testing-library/react"; -describe("reactContextStoreFactory", () => { +describe("reactContextFeaturesStoreFactory", () => { const name = "test-name"; let reactContextStore; beforeEach(() => { - reactContextStore = reactContextStoreFactory({ name }); + reactContextStore = reactContextFeaturesStoreFactory({ name }); }); describe("when creating a provider", () => { diff --git a/packages/features/src/ssrBackedReactContext/store.js b/packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.js similarity index 95% rename from packages/features/src/ssrBackedReactContext/store.js rename to packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.js index 44b624f..f2078b9 100644 --- a/packages/features/src/ssrBackedReactContext/store.js +++ b/packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.js @@ -1,5 +1,5 @@ import { withJsonIsomorphism } from "@asos/web-toggle-point-ssr"; -import reactContextFeaturesStoreFactory from "../reactContext/store"; +import reactContextFeaturesStoreFactory from "./reactContextFeaturesStoreFactory"; /** * A factory function used to create a store for features, held in a {@link https://reactjs.org/docs/context.html|React context}, backed by server-side rendering. diff --git a/packages/features/src/ssrBackedReactContext/store.test.js b/packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.test.js similarity index 89% rename from packages/features/src/ssrBackedReactContext/store.test.js rename to packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.test.js index 440d10d..0bfc09a 100644 --- a/packages/features/src/ssrBackedReactContext/store.test.js +++ b/packages/features/src/storeFactories/ssrBackedReactContextFeaturesStoreFactory.test.js @@ -1,7 +1,7 @@ import { withJsonIsomorphism } from "@asos/web-toggle-point-ssr"; import { render, screen } from "@testing-library/react"; -import reactContextFeaturesStoreFactory from "../reactContext/store"; -import ssrBackedReactContextFeaturesStoreFactory from "./store"; +import reactContextFeaturesStoreFactory from "./reactContextFeaturesStoreFactory"; +import ssrBackedReactContextFeaturesStoreFactory from "./ssrBackedReactContextFeaturesStoreFactory"; const MockSSRBackedFeaturesProvider = jest.fn(({ children }) => (

{children}
@@ -12,12 +12,12 @@ jest.mock("@asos/web-toggle-point-ssr", () => ({ const mockOtherStuff = { [Symbol("rest")]: Symbol("rest") }; -const mockReactContextStoreFactory = { +const mockReactContextFeaturesStoreFactory = { providerFactory: jest.fn(), ...mockOtherStuff }; -jest.mock("../reactContext/store", () => - jest.fn(() => mockReactContextStoreFactory) +jest.mock("./reactContextFeaturesStoreFactory", () => + jest.fn(() => mockReactContextFeaturesStoreFactory) ); describe("ssrBackedReactContextFeaturesStoreFactory", () => { @@ -52,7 +52,9 @@ describe("ssrBackedReactContextFeaturesStoreFactory", () => { }); it("should create a reactContextStore via the reactContextStoreFactory", () => { - expect(mockReactContextStoreFactory.providerFactory).toHaveBeenCalled(); + expect( + mockReactContextFeaturesStoreFactory.providerFactory + ).toHaveBeenCalled(); }); it("should create an SSR-backed react component that serializes the provided value in a script with a namespace & named id", () => { From 632f06bc139ccc74ae3bbe38d46d49e2e3540bbd Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Sun, 6 Jul 2025 18:25:56 +0100 Subject: [PATCH 06/24] fixup jsdoc --- .../storeFactories/nodeRequestScopedFeaturesStoreFactory.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js index 42eb523..4b4e75c 100644 --- a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js @@ -5,7 +5,7 @@ import { AsyncLocalStorage } from "async_hooks"; * Should only be used server-side, for anything user or request specific. * A thin wrapper around node {@link https://nodejs.org/api/async_context.html#class-asynclocalstorage|AsyncLocalStorage}, used as an extension point for future plugins. * @memberof module:web-toggle-point-features - * @returns {module:web-toggle-point-features.requestScopedFeaturesStore} A store for features, scoped for the current request. + * @returns {module:web-toggle-point-features.nodeRequestScopedFeaturesStore} A store for features, scoped for the current request. */ const nodeRequestScopedFeaturesStoreFactory = () => { const store = new AsyncLocalStorage(); @@ -26,7 +26,7 @@ const nodeRequestScopedFeaturesStoreFactory = () => { throw Error("Called outside of request context"); } return features; - } + }, }; }; From 5472a326a4f8f4978888c3d5ea76570d880984e4 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Sun, 6 Jul 2025 18:29:13 +0100 Subject: [PATCH 07/24] consolidate filter --- packages/features/build/rollup.mjs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/features/build/rollup.mjs b/packages/features/build/rollup.mjs index 8e78412..f2781d8 100644 --- a/packages/features/build/rollup.mjs +++ b/packages/features/build/rollup.mjs @@ -12,8 +12,10 @@ export default async ({ config_isBrowser }) => { const browserPrefix = isBrowser ? "browser." : ""; const input = (await readdir("./src/storeFactories")) - .filter((file) => !file.endsWith(".test.js")) - .filter((file) => !(file.startsWith("node") && isBrowser)) + .filter( + (file) => + !file.endsWith(".test.js") && !(file.startsWith("node") && isBrowser) + ) .map((factory) => `./src/storeFactories/${factory}`); return { @@ -23,29 +25,29 @@ export default async ({ config_isBrowser }) => { dir: "lib/", entryFileNames: `[name].${browserPrefix}js`, format: "es", - sourcemap: true + sourcemap: true, }, { dir: "lib/", entryFileNames: `[name].${browserPrefix}es5.cjs`, format: "cjs", - sourcemap: true - } + sourcemap: true, + }, ], external: ["react/jsx-runtime"], plugins: [ keepExternalComments, babel({ exclude: /node_modules/, - babelHelpers: "runtime" + babelHelpers: "runtime", }), resolve({ - preferBuiltins: true + preferBuiltins: true, }), commonjs(), external(), - isBrowser ? [terser()] : [] + isBrowser ? [terser()] : [], ], - preserveSymlinks: true + preserveSymlinks: true, }; }; From 11877b27c3fd14d9daf5173952658f780c2023f3 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Sun, 6 Jul 2025 18:33:28 +0100 Subject: [PATCH 08/24] lint --- packages/features/build/rollup.mjs | 14 +++++++------- .../nodeRequestScopedFeaturesStoreFactory.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/features/build/rollup.mjs b/packages/features/build/rollup.mjs index f2781d8..7477092 100644 --- a/packages/features/build/rollup.mjs +++ b/packages/features/build/rollup.mjs @@ -25,29 +25,29 @@ export default async ({ config_isBrowser }) => { dir: "lib/", entryFileNames: `[name].${browserPrefix}js`, format: "es", - sourcemap: true, + sourcemap: true }, { dir: "lib/", entryFileNames: `[name].${browserPrefix}es5.cjs`, format: "cjs", - sourcemap: true, - }, + sourcemap: true + } ], external: ["react/jsx-runtime"], plugins: [ keepExternalComments, babel({ exclude: /node_modules/, - babelHelpers: "runtime", + babelHelpers: "runtime" }), resolve({ - preferBuiltins: true, + preferBuiltins: true }), commonjs(), external(), - isBrowser ? [terser()] : [], + isBrowser ? [terser()] : [] ], - preserveSymlinks: true, + preserveSymlinks: true }; }; diff --git a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js index 4b4e75c..e268b44 100644 --- a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js @@ -26,7 +26,7 @@ const nodeRequestScopedFeaturesStoreFactory = () => { throw Error("Called outside of request context"); } return features; - }, + } }; }; From 35fac0850fc71bd077ec5d7184105557e7133afb Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:45:56 +0100 Subject: [PATCH 09/24] useValue -> setValue note regarding eslint-plugin-import --- .../src/fixtures/audience/__featuresStore.js | 2 +- .../src/fixtures/config/__featuresStore.js | 2 +- .../src/fixtures/event/__featuresStore.js | 2 +- .../fixtures/translation/__featuresStore.js | 2 +- .../build/eslint-import-backfill.rollup.mjs | 9 ++++++++ packages/features/build/rollup.mjs | 4 ++-- packages/features/docs/CHANGELOG.md | 7 ++++++- packages/features/docs/README.md | 21 ++++++++++++------- packages/features/package.json | 7 ++++--- packages/features/src/global.js | 2 +- 10 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 packages/features/build/eslint-import-backfill.rollup.mjs diff --git a/examples/serve/src/fixtures/audience/__featuresStore.js b/examples/serve/src/fixtures/audience/__featuresStore.js index d673a89..9c89305 100644 --- a/examples/serve/src/fixtures/audience/__featuresStore.js +++ b/examples/serve/src/fixtures/audience/__featuresStore.js @@ -5,6 +5,6 @@ const featuresStore = featuresStoreFactory(); const [, audience] = document.cookie.match(/audience=(.+?)(;|$)/) || []; -featuresStore.useValue({ value: audience }); +featuresStore.setValue({ value: audience }); export default featuresStore; diff --git a/examples/serve/src/fixtures/config/__featuresStore.js b/examples/serve/src/fixtures/config/__featuresStore.js index 21fbea4..2ec0c5b 100644 --- a/examples/serve/src/fixtures/config/__featuresStore.js +++ b/examples/serve/src/fixtures/config/__featuresStore.js @@ -3,6 +3,6 @@ import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories const featuresStore = featuresStoreFactory(); -featuresStore.useValue({ value: new URL(document.URL).pathname.slice(1) }); +featuresStore.setValue({ value: new URL(document.URL).pathname.slice(1) }); export default featuresStore; diff --git a/examples/serve/src/fixtures/event/__featuresStore.js b/examples/serve/src/fixtures/event/__featuresStore.js index cfd1208..2cf89f9 100644 --- a/examples/serve/src/fixtures/event/__featuresStore.js +++ b/examples/serve/src/fixtures/event/__featuresStore.js @@ -16,6 +16,6 @@ const getEvent = () => { } }; -featuresStore.useValue({ value: getEvent() }); +featuresStore.setValue({ value: getEvent() }); export default featuresStore; diff --git a/examples/serve/src/fixtures/translation/__featuresStore.js b/examples/serve/src/fixtures/translation/__featuresStore.js index 2098e43..e58d224 100644 --- a/examples/serve/src/fixtures/translation/__featuresStore.js +++ b/examples/serve/src/fixtures/translation/__featuresStore.js @@ -3,7 +3,7 @@ import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories const featuresStore = featuresStoreFactory(); -featuresStore.useValue({ +featuresStore.setValue({ value: navigator.language || document.documentElement.lang }); diff --git a/packages/features/build/eslint-import-backfill.rollup.mjs b/packages/features/build/eslint-import-backfill.rollup.mjs new file mode 100644 index 0000000..e15795b --- /dev/null +++ b/packages/features/build/eslint-import-backfill.rollup.mjs @@ -0,0 +1,9 @@ +export default { + input: "./src/global.js", + output: { + file: "lib/global.js", + format: "es", + sourcemap: true + }, + treeshake: false +}; diff --git a/packages/features/build/rollup.mjs b/packages/features/build/rollup.mjs index 7477092..56822b7 100644 --- a/packages/features/build/rollup.mjs +++ b/packages/features/build/rollup.mjs @@ -22,13 +22,13 @@ export default async ({ config_isBrowser }) => { input, output: [ { - dir: "lib/", + dir: "lib/storeFactories/", entryFileNames: `[name].${browserPrefix}js`, format: "es", sourcemap: true }, { - dir: "lib/", + dir: "lib/storeFactories/", entryFileNames: `[name].${browserPrefix}es5.cjs`, format: "cjs", sourcemap: true diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index bc71c80..3bcfb9e 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved to named exports, to ensure that the "ssr" package is not a dependency, unless importing the `ssrBackedReactContextFeaturesStoreFactory` +### Changed + +- renamed `useValue` from `SingletonFeaturesStore` interface to `setValue`, to avoid React [rules-of-hooks](https://react.dev/warnings/invalid-hook-call-warning) errors +- added a backfill main entry to `package.json` to support [missing exports / ESM support in `eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import/issues/1810), for users of this + ## [0.3.4] - 2025-07-14 ### Fixed @@ -22,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - added `package.json` [homepage](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#homepage), for clarity once on https://www.npmjs.com/ -- move the React 17 note to the end, in the `README.md`, since only relevant to the last two store factories & added companion note regarding `react-dom/server`. +- move the React 17 note to the end, in the `README.md`, since only relevant to the last two store factories & added companion note regarding `react-dom/server` ### Fixed diff --git a/packages/features/docs/README.md b/packages/features/docs/README.md index 4290324..04de567 100644 --- a/packages/features/docs/README.md +++ b/packages/features/docs/README.md @@ -12,15 +12,21 @@ See: [JSDoc output](https://asos.github.io/web-toggle-point/module-web-toggle-po ## Exports +> [!WARNING] +> This package uses [`package.json` exports](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#exports) to specify individual stores (listed below), to ensure that browser / node specific stores can +> be individually imported and prevent build failures where, prior to tree-shaking, incompatible APIs / globals are referenced. +> Due to [a long-standing bug in `eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import/issues/1810), users of eslint with this plugin may need to ignore an [`import/no-unresolved`](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md) error, +> or move to a modern alternative for this plugin (e.g. [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x)), or use [a typescript parser](https://typescript-eslint.io/packages/parser/) (which understands `exports`) + The package contains the following exports: -### `globalFeaturesStoreFactory` +### `storeFactories/globalFeaturesStoreFactory` A "global" features store factory: a thin wrapper around a singleton, this is an extension point for future plugins etc. It exports a store with: -- a `useValue` function, that sets a current value. +- a `setValue` function, that sets a current value. - a `getFeatures` function - designed to be passed as the `getActiveFeatures` input of the `withTogglePointFactory` or `withToggledHookFactory` from the [`react-pointcuts` package](../../react-pointcuts/docs/README.md). @@ -47,12 +53,12 @@ const getActiveFeatures = useSnapshot.bind(undefined, value); // passed to `with ``` ...which will then re-render consuming components based on the parts of the toggle state they are reliant on. -### `nodeRequestScopedStoreFactory` +### `storeFactories/nodeRequestScopedFeaturesStoreFactory` A "request scoped" features store factory, for use in [Node](https://nodejs.org/). It exports a store with: -- a `useValue` function that sets a current value, taking a `scopeCallBack` (along with a `value`), under which the value is scoped. +- a `setValue` function that sets a current value, taking a `scopeCallBack` (along with a `value`), under which the value is scoped. - This is using [`AsyncLocalStorage.run`](https://nodejs.org/api/async_context.html#asynclocalstoragerunstore-callback-args) under the hood, which can be plugged into Express middleware thus: ```js import express from "express"; @@ -62,7 +68,7 @@ It exports a store with: app.use((request, response, next) => { const value = ?? // some value holding toggle state, either based on `request`, or scoped from outside this middleware, etc. - featuresStore.useValue({ value, scopeCallBack: next }); + featuresStore.setValue({ value, scopeCallBack: next }); }); app.use("/", () => { /* routes that require toggled code */ }); ``` @@ -70,9 +76,10 @@ It exports a store with: - designed to be passed as the `getActiveFeatures` input of the `withTogglePointFactory` or `withToggledHookFactory` from the [`react-pointcuts` package](../../react-pointcuts/docs/README.md). > [!WARNING] > This will throw an error if called outside of a request scope, so care should be taken to set up the toggle point config to only toggle modules called within the call stack of the middleware. +> Wrap the `setValue` call in a `try` / `catch`, if prior access is expected. > If this happens unexpectedly, follow the advice [here](https://nodejs.org/api/async_context.html#troubleshooting-context-loss). -### `reactContextFeaturesStoreFactory` +### `storeFactories/reactContextFeaturesStoreFactory` It exports a store with: - a `providerFactory` factory function, creating a [react context provider](https://reactjs.org/docs/context.html#contextprovider). @@ -81,7 +88,7 @@ It exports a store with: - this uses [`useContext`](https://react.dev/reference/react/useContext) internally, so should be used honouring the rules of hooks. It will make consumers reactive to any change of the toggle state. - can be passed to `getActiveFeatures` of `withTogglePointFactory` / `withToggledHookFactory` from the [`react-pointcuts` package](../../react-pointcuts/docs/README.md). -### `ssrBackedReactContextFeaturesStoreFactory` +### `storeFactories/ssrBackedReactContextFeaturesStoreFactory` It exports a store with the same signature as that exported by `reactContextFeaturesStoreFactory`. It utilises `withJsonIsomorphism` from the [`ssr` package](../../ssr/docs/README.md) internally, to create ["isomorphic" or "universal"](https://en.wikipedia.org/wiki/Isomorphic_JavaScript) contexts, for use in framework-less React applications. The value set on the server will be realised as the initial value within the browser. diff --git a/packages/features/package.json b/packages/features/package.json index 80591c8..24b5924 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -4,11 +4,11 @@ "version": "0.4.0", "license": "MIT", "type": "module", - "main": "./lib/main.es5.cjs", + "main": "./lib/global.js", "sideEffects": false, "exports": { ".": null, - "./storeFactories/*": { + "./*": { "node": { "import": "./lib/*.js", "require": "./lib/*.es5.cjs" @@ -34,7 +34,8 @@ "scripts": { "build-dependencies": "path-exists ../../packages/ssr/lib || npm run --prefix ../../packages/ssr build", "prebuild": "npm run build-dependencies", - "build": "npm run clean && npm run build:browser && npm run build:server", + "build": "npm run clean && npm run build:browser && npm run build:server && npm run build:eslint-import-backfill", + "build:eslint-import-backfill": "rollup -c build/eslint-import-backfill.rollup.mjs", "build:browser": "cross-env BABEL_ENV=browser rollup -c build/rollup.mjs --config_isBrowser true", "build:server": "rollup -c build/rollup.mjs --config_isBrowser false", "prepublishOnly": "npm run build", diff --git a/packages/features/src/global.js b/packages/features/src/global.js index bd618e8..7e8f4e3 100644 --- a/packages/features/src/global.js +++ b/packages/features/src/global.js @@ -31,7 +31,7 @@ import "./external"; * * @function * @memberof module:web-toggle-point-features - * @name SingletonFeaturesStore#useValue + * @name SingletonFeaturesStore#setValue * @param {object} params parameters * @param {object} params.value A value to store, used to drive feature toggles. */ From 7a05c13894f2383c317ff20119bf67c5873d2115 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:23:02 +0100 Subject: [PATCH 10/24] fixup for typescript failure in pipeline --- examples/express/docs/CHANGELOG.md | 4 ++++ examples/express/playwright.config.ts | 2 +- examples/next/docs/CHANGELOG.md | 4 ++++ examples/next/playwright.config.ts | 3 ++- .../experiments/1-varied-component/playwright.spec.ts | 2 +- .../fixtures/experiments/4-varied-variant/playwright.spec.ts | 2 +- examples/next/src/app/fixtures/experiments/getExperiments.ts | 2 +- examples/next/src/app/fixtures/experiments/layout.tsx | 2 +- .../fixtures/experiments/playwright.setExperimentHeaders.ts | 4 ++-- examples/next/src/app/layout.tsx | 2 +- examples/next/src/components/control1.tsx | 2 +- examples/next/src/components/control2.tsx | 2 +- examples/next/src/components/variant1.tsx | 2 +- examples/next/src/components/variant2.tsx | 2 +- examples/serve/docs/CHANGELOG.md | 4 ++++ examples/serve/playwright.config.ts | 2 +- 16 files changed, 27 insertions(+), 14 deletions(-) diff --git a/examples/express/docs/CHANGELOG.md b/examples/express/docs/CHANGELOG.md index 875bc4c..a9d5d2c 100644 --- a/examples/express/docs/CHANGELOG.md +++ b/examples/express/docs/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-15)) +### Fixed + +- import types explicitly from `@playwright/test` after unexpected pipeline failure + ## [0.2.5] - 2025-05-27 ### Changed diff --git a/examples/express/playwright.config.ts b/examples/express/playwright.config.ts index 0288d5e..c0e2fbd 100644 --- a/examples/express/playwright.config.ts +++ b/examples/express/playwright.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, PlaywrightTestConfig } from "@playwright/test"; +import { defineConfig, type PlaywrightTestConfig } from "@playwright/test"; import baseConfig from "../../test/automation/base.config"; const config: PlaywrightTestConfig = { diff --git a/examples/next/docs/CHANGELOG.md b/examples/next/docs/CHANGELOG.md index f345e50..6429dd7 100644 --- a/examples/next/docs/CHANGELOG.md +++ b/examples/next/docs/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-15)) +### Fixed + +- import types explicitly from `@playwright/test` & internally, after unexpected pipeline failure + ## [0.2.4] - 2025-05-27 ### Changed diff --git a/examples/next/playwright.config.ts b/examples/next/playwright.config.ts index 2f163c0..331c13c 100644 --- a/examples/next/playwright.config.ts +++ b/examples/next/playwright.config.ts @@ -1,4 +1,5 @@ -import { defineConfig, PlaywrightTestConfig } from "@playwright/test"; +import { defineConfig, type PlaywrightTestConfig } from "@playwright/test"; +// eslint-disable-next-line workspaces/no-relative-imports, workspaces/require-dependency import baseConfig from "../../test/automation/base.config"; const THREE_MINUTES = 3 * 60 * 1000; diff --git a/examples/next/src/app/fixtures/experiments/1-varied-component/playwright.spec.ts b/examples/next/src/app/fixtures/experiments/1-varied-component/playwright.spec.ts index 2350b62..e61d32d 100644 --- a/examples/next/src/app/fixtures/experiments/1-varied-component/playwright.spec.ts +++ b/examples/next/src/app/fixtures/experiments/1-varied-component/playwright.spec.ts @@ -1,4 +1,4 @@ -import { test, expect, ConsoleMessage } from "@playwright/test"; +import { test, expect, type ConsoleMessage } from "@playwright/test"; import setExperimentHeaders from "../playwright.setExperimentHeaders"; import locateWithinExample from "../playwright.locateInExample"; import getFixtureURL from "../playwright.getFixtureUrl"; diff --git a/examples/next/src/app/fixtures/experiments/4-varied-variant/playwright.spec.ts b/examples/next/src/app/fixtures/experiments/4-varied-variant/playwright.spec.ts index 7e02386..e4b4fc4 100644 --- a/examples/next/src/app/fixtures/experiments/4-varied-variant/playwright.spec.ts +++ b/examples/next/src/app/fixtures/experiments/4-varied-variant/playwright.spec.ts @@ -1,4 +1,4 @@ -import { test, expect, ConsoleMessage } from "@playwright/test"; +import { test, expect, type ConsoleMessage } from "@playwright/test"; import setExperimentHeaders from "../playwright.setExperimentHeaders"; import locateWithinExample from "../playwright.locateInExample"; import getFixtureURL from "../playwright.getFixtureUrl"; diff --git a/examples/next/src/app/fixtures/experiments/getExperiments.ts b/examples/next/src/app/fixtures/experiments/getExperiments.ts index fc2f1ab..1ff2086 100644 --- a/examples/next/src/app/fixtures/experiments/getExperiments.ts +++ b/examples/next/src/app/fixtures/experiments/getExperiments.ts @@ -1,5 +1,5 @@ import { headers } from "next/headers"; -import { Experiments } from "./experiments"; +import { type Experiments } from "./experiments"; export default async function getExperiments(): Promise< Experiments | Record diff --git a/examples/next/src/app/fixtures/experiments/layout.tsx b/examples/next/src/app/fixtures/experiments/layout.tsx index 7b23ca7..89e2d6d 100644 --- a/examples/next/src/app/fixtures/experiments/layout.tsx +++ b/examples/next/src/app/fixtures/experiments/layout.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from "react"; +import { type ReactNode } from "react"; import getExperiments from "./getExperiments"; import Example from "./example"; diff --git a/examples/next/src/app/fixtures/experiments/playwright.setExperimentHeaders.ts b/examples/next/src/app/fixtures/experiments/playwright.setExperimentHeaders.ts index 20e0c84..4b16956 100644 --- a/examples/next/src/app/fixtures/experiments/playwright.setExperimentHeaders.ts +++ b/examples/next/src/app/fixtures/experiments/playwright.setExperimentHeaders.ts @@ -1,4 +1,4 @@ -import { +import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, @@ -6,7 +6,7 @@ import { PlaywrightWorkerOptions } from "@playwright/test"; -import { Experiments, Decision } from "./experiments"; +import type { Experiments, Decision } from "./experiments"; const setExperimentHeaders = ( test: TestType< diff --git a/examples/next/src/app/layout.tsx b/examples/next/src/app/layout.tsx index bcc6be7..76a927c 100644 --- a/examples/next/src/app/layout.tsx +++ b/examples/next/src/app/layout.tsx @@ -1,6 +1,6 @@ import { Didact_Gothic } from "next/font/google"; import styles from "./styles.module.css"; -import { ReactNode } from "react"; +import { type ReactNode } from "react"; const didactGothic = Didact_Gothic({ display: "swap", diff --git a/examples/next/src/components/control1.tsx b/examples/next/src/components/control1.tsx index 9e5ade3..3d55048 100644 --- a/examples/next/src/components/control1.tsx +++ b/examples/next/src/components/control1.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from "react"; +import React, { type ReactNode } from "react"; import styles from "./styles.module.css"; interface Control1Props { diff --git a/examples/next/src/components/control2.tsx b/examples/next/src/components/control2.tsx index 01d0f02..5606522 100644 --- a/examples/next/src/components/control2.tsx +++ b/examples/next/src/components/control2.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from "react"; +import React, { type ReactNode } from "react"; import styles from "./styles.module.css"; interface Control2Props { diff --git a/examples/next/src/components/variant1.tsx b/examples/next/src/components/variant1.tsx index 172c301..934c19f 100644 --- a/examples/next/src/components/variant1.tsx +++ b/examples/next/src/components/variant1.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from "react"; +import React, { type ReactNode } from "react"; import styles from "./styles.module.css"; interface Variant1Props { diff --git a/examples/next/src/components/variant2.tsx b/examples/next/src/components/variant2.tsx index aa03206..d6b1c56 100644 --- a/examples/next/src/components/variant2.tsx +++ b/examples/next/src/components/variant2.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from "react"; +import React, { type ReactNode } from "react"; import styles from "./styles.module.css"; interface Variant2Props { diff --git a/examples/serve/docs/CHANGELOG.md b/examples/serve/docs/CHANGELOG.md index c7ed008..e98c82f 100644 --- a/examples/serve/docs/CHANGELOG.md +++ b/examples/serve/docs/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated to named exports version of "features" package ([0.4.0](../../../packages/features/docs/CHANGELOG.md#040---2025-07-15)) +### Fixed + +- import types explicitly from `@playwright/test` after unexpected pipeline failure + ## [0.2.6] - 2025-07-14 ### Changed diff --git a/examples/serve/playwright.config.ts b/examples/serve/playwright.config.ts index c0a196a..1b73718 100644 --- a/examples/serve/playwright.config.ts +++ b/examples/serve/playwright.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, PlaywrightTestConfig } from "@playwright/test"; +import { defineConfig, type PlaywrightTestConfig } from "@playwright/test"; import baseConfig from "../../test/automation/base.config"; const config: PlaywrightTestConfig = { From 576d4a65929805821f1371e8d895992d95d59a9c Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 17:31:42 +0100 Subject: [PATCH 11/24] another type... --- test/automation/base.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/automation/base.config.ts b/test/automation/base.config.ts index 3fa6253..d5f9920 100644 --- a/test/automation/base.config.ts +++ b/test/automation/base.config.ts @@ -1,4 +1,4 @@ -import { devices, ReporterDescription } from "@playwright/test"; +import { devices, type ReporterDescription } from "@playwright/test"; const baseConfig = { fullyParallel: true, From 479930bd1dfe268dae3466f0887244cd5886e9b6 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:39:50 +0100 Subject: [PATCH 12/24] sigh... more types --- .../src/app/fixtures/experiments/playwright.locateInExample.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/next/src/app/fixtures/experiments/playwright.locateInExample.ts b/examples/next/src/app/fixtures/experiments/playwright.locateInExample.ts index 32224e8..970c9d2 100644 --- a/examples/next/src/app/fixtures/experiments/playwright.locateInExample.ts +++ b/examples/next/src/app/fixtures/experiments/playwright.locateInExample.ts @@ -1,4 +1,4 @@ -import { Page, Locator } from "@playwright/test"; +import type { Page, Locator } from "@playwright/test"; function locateWithinExample(page: Page, testId: string): Locator { return page.locator("#example").getByTestId(testId); From 6b3f64a904041fc6247f1e9ea7b198aa3c6dfb1b Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:41:50 +0100 Subject: [PATCH 13/24] danger : changelog --- test/automation/docs/CHANGELOG.md | 4 ++++ test/automation/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/automation/docs/CHANGELOG.md b/test/automation/docs/CHANGELOG.md index 6a53fe4..5ca2e6c 100644 --- a/test/automation/docs/CHANGELOG.md +++ b/test/automation/docs/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2025-08-21 + +- move to import type for `ReporterDescription` + ## [0.1.2] - 2024-12-18 ### Fixed diff --git a/test/automation/package.json b/test/automation/package.json index 4798d47..70dd3cb 100644 --- a/test/automation/package.json +++ b/test/automation/package.json @@ -1,6 +1,6 @@ { "name": "web-toggle-point-automation-tests", - "version": "0.1.2", + "version": "0.1.3", "main": "index.js", "keywords": [], "type": "module", From 631df061b130f281fc27cefe2a8e4653fe87d5d1 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:42:10 +0100 Subject: [PATCH 14/24] proper format changelog --- test/automation/docs/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/automation/docs/CHANGELOG.md b/test/automation/docs/CHANGELOG.md index 5ca2e6c..ca475a7 100644 --- a/test/automation/docs/CHANGELOG.md +++ b/test/automation/docs/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.3] - 2025-08-21 +### Changed + - move to import type for `ReporterDescription` ## [0.1.2] - 2024-12-18 From 54ed0a144a726f24723b94a6d05c47e8e58a5050 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:05:53 +0100 Subject: [PATCH 15/24] some missing useValue -> setValue stuff somehow missed --- examples/express/src/routes/animals/middleware.js | 2 +- package-lock.json | 2 +- .../src/storeFactories/globalFeaturesStoreFactory.js | 2 +- .../src/storeFactories/globalFeaturesStoreFactory.test.js | 8 ++++---- .../nodeRequestScopedFeaturesStoreFactory.js | 2 +- .../nodeRequestScopedFeaturesStoreFactory.test.js | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/express/src/routes/animals/middleware.js b/examples/express/src/routes/animals/middleware.js index ef8eae2..b0be783 100644 --- a/examples/express/src/routes/animals/middleware.js +++ b/examples/express/src/routes/animals/middleware.js @@ -9,7 +9,7 @@ const contextMiddleware = (request, response, scopeCallBack) => { return; } response.header("Vary", version); - featuresStore.useValue({ value: { version }, scopeCallBack }); + featuresStore.setValue({ value: { version }, scopeCallBack }); }; export default contextMiddleware; diff --git a/package-lock.json b/package-lock.json index 6070fbc..8a445d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20035,7 +20035,7 @@ }, "test/automation": { "name": "web-toggle-point-automation-tests", - "version": "0.1.2", + "version": "0.1.3", "devDependencies": { "@playwright/test": "^1.49.0", "@types/node": "^22.9.1", diff --git a/packages/features/src/storeFactories/globalFeaturesStoreFactory.js b/packages/features/src/storeFactories/globalFeaturesStoreFactory.js index 2a0c8da..cccf561 100644 --- a/packages/features/src/storeFactories/globalFeaturesStoreFactory.js +++ b/packages/features/src/storeFactories/globalFeaturesStoreFactory.js @@ -20,7 +20,7 @@ const globalFeaturesStoreFactory = () => { * @implements module:web-toggle-point-features.SingletonFeaturesStore */ return { - useValue: ({ value }) => { + setValue: ({ value }) => { storeMap.set(identifier, value); }, getFeatures: () => storeMap.get(identifier) diff --git a/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js b/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js index 9b63015..126183d 100644 --- a/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js +++ b/packages/features/src/storeFactories/globalFeaturesStoreFactory.test.js @@ -7,22 +7,22 @@ describe("globalFeaturesStoreFactory", () => { featuresStoreFactory = globalFeaturesStoreFactory(); }); - describe("when using a value", () => { + describe("when setting a value", () => { const value = Symbol("test-value"); beforeEach(() => { - featuresStoreFactory.useValue({ value }); + featuresStoreFactory.setValue({ value }); }); it("should store the value for later retrieval", () => { expect(featuresStoreFactory.getFeatures()).toBe(value); }); - describe("when using a different value", () => { + describe("when setting a different value", () => { const differentValue = Symbol("different-value"); beforeEach(() => { - featuresStoreFactory.useValue({ value: differentValue }); + featuresStoreFactory.setValue({ value: differentValue }); }); it("should store the new value for later retrieval", () => { diff --git a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js index e268b44..9e74106 100644 --- a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.js @@ -17,7 +17,7 @@ const nodeRequestScopedFeaturesStoreFactory = () => { * @implements module:web-toggle-point-features.SingletonFeaturesStore */ return { - useValue: ({ value, scopeCallBack }) => { + setValue: ({ value, scopeCallBack }) => { store.run(value, scopeCallBack); }, getFeatures: () => { diff --git a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js index d554fee..86ae84d 100644 --- a/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js +++ b/packages/features/src/storeFactories/nodeRequestScopedFeaturesStoreFactory.test.js @@ -27,12 +27,12 @@ describe("nodeRequestScopedFeaturesStoreFactory", () => { }); }); - describe("when using a value", () => { + describe("when setting a value", () => { const value = Symbol("test-value"); const scopeCallBack = Symbol("test-callback"); beforeEach(() => { - requestScopedStore.useValue({ value, scopeCallBack }); + requestScopedStore.setValue({ value, scopeCallBack }); }); it("should scope the value to the descendants of the callback, by running it in the local storage", () => { From 38473a52ed33c0c849df96137e1b67fbd6daadf9 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:10:17 +0100 Subject: [PATCH 16/24] note in changelog --- packages/features/docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index 3bcfb9e..c53f151 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Moved to named exports, to ensure that the "ssr" package is not a dependency, unless importing the `ssrBackedReactContextFeaturesStoreFactory` + - This reverts to the intent of version [version 0.3.0](#030---2024-11-28), but not capitulating to ESLint's issues ### Changed From 2c3fc893a48c81ee4856a97c557d93d594969a8d Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:19:45 +0100 Subject: [PATCH 17/24] default/browser exports - seems most palatable to linting/ts/etc. --- package-lock.json | 2 +- packages/features/package.json | 10 +++++----- packages/react-pointcuts/build/rollup.mjs | 4 ++-- packages/react-pointcuts/docs/CHANGELOG.md | 6 ++++++ packages/react-pointcuts/package.json | 12 ++++++------ packages/ssr/build/rollup.mjs | 4 ++-- packages/ssr/package.json | 10 +++++----- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8a445d7..413515b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19864,7 +19864,7 @@ }, "packages/react-pointcuts": { "name": "@asos/web-toggle-point-react-pointcuts", - "version": "0.4.5", + "version": "0.4.6", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0" diff --git a/packages/features/package.json b/packages/features/package.json index 24b5924..530a776 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -9,13 +9,13 @@ "exports": { ".": null, "./*": { - "node": { - "import": "./lib/*.js", - "require": "./lib/*.es5.cjs" - }, - "default": { + "browser": { "import": "./lib/*.browser.js", "require": "./lib/*.browser.es5.cjs" + }, + "default": { + "import": "./lib/*.js", + "require": "./lib/*.es5.cjs" } } }, diff --git a/packages/react-pointcuts/build/rollup.mjs b/packages/react-pointcuts/build/rollup.mjs index d893632..4ac969c 100644 --- a/packages/react-pointcuts/build/rollup.mjs +++ b/packages/react-pointcuts/build/rollup.mjs @@ -9,8 +9,8 @@ import keepExternalComments from "./keepExternalComments.mjs"; export default ({ config_isClient }) => { const CLIENT = JSON.parse(config_isClient); const [esOutputFile, cjsOutputFile, extraPlugins] = { - false: [pkg.exports.node.import, pkg.exports.node.require, []], - true: [pkg.exports.default.import, pkg.exports.default.require, [terser()]] + false: [pkg.exports.default.import, pkg.exports.default.require, []], + true: [pkg.exports.browser.import, pkg.exports.browser.require, [terser()]] }[CLIENT]; return { diff --git a/packages/react-pointcuts/docs/CHANGELOG.md b/packages/react-pointcuts/docs/CHANGELOG.md index bad889d..df9c037 100644 --- a/packages/react-pointcuts/docs/CHANGELOG.md +++ b/packages/react-pointcuts/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.6] - 2025-08-21 + +### Fixed + +- moved to `default` and `browser` exports from `node` and `default`, to support typescript module resolution + ## [0.4.5] - 2025-07-14 ### Fixed diff --git a/packages/react-pointcuts/package.json b/packages/react-pointcuts/package.json index 1543e49..a980125 100644 --- a/packages/react-pointcuts/package.json +++ b/packages/react-pointcuts/package.json @@ -1,18 +1,18 @@ { "name": "@asos/web-toggle-point-react-pointcuts", "description": "react pointcut code", - "version": "0.4.5", + "version": "0.4.6", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", "exports": { - "node": { - "import": "./lib/main.js", - "require": "./lib/main.es5.cjs" - }, - "default": { + "browser": { "import": "./lib/browser.js", "require": "./lib/browser.es5.cjs" + }, + "default": { + "import": "./lib/main.js", + "require": "./lib/main.es5.cjs" } }, "repository": { diff --git a/packages/ssr/build/rollup.mjs b/packages/ssr/build/rollup.mjs index 3010b9e..8828873 100644 --- a/packages/ssr/build/rollup.mjs +++ b/packages/ssr/build/rollup.mjs @@ -10,8 +10,8 @@ import terser from "@rollup/plugin-terser"; export default ({ config_isClient }) => { const CLIENT = JSON.parse(config_isClient); const [esOutputFile, cjsOutputFile, extraPlugins] = { - false: [pkg.exports.node.import, pkg.exports.node.require, []], - true: [pkg.exports.default.import, pkg.exports.default.require, [terser()]] + false: [pkg.exports.default.import, pkg.exports.default.require, []], + true: [pkg.exports.browser.import, pkg.exports.browser.require, [terser()]] }[CLIENT]; return { diff --git a/packages/ssr/package.json b/packages/ssr/package.json index dcdc958..ebfd99d 100644 --- a/packages/ssr/package.json +++ b/packages/ssr/package.json @@ -6,13 +6,13 @@ "type": "module", "main": "./lib/main.es5.cjs", "exports": { - "node": { - "import": "./lib/main.js", - "require": "./lib/main.es5.cjs" - }, - "default": { + "browser": { "import": "./lib/browser.js", "require": "./lib/browser.es5.cjs" + }, + "default": { + "import": "./lib/main.js", + "require": "./lib/main.es5.cjs" } }, "repository": { From d7c3ef92391904acba3e33a4008814e3fb7d1884 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 20:23:15 +0100 Subject: [PATCH 18/24] ssr changelog --- package-lock.json | 2 +- packages/ssr/docs/CHANGELOG.md | 6 ++++++ packages/ssr/package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 413515b..48e33c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19900,7 +19900,7 @@ }, "packages/ssr": { "name": "@asos/web-toggle-point-ssr", - "version": "0.2.3", + "version": "0.2.4", "license": "MIT", "dependencies": { "@babel/runtime": "^7.26.0", diff --git a/packages/ssr/docs/CHANGELOG.md b/packages/ssr/docs/CHANGELOG.md index 058d6d5..aa0509e 100644 --- a/packages/ssr/docs/CHANGELOG.md +++ b/packages/ssr/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.4] - 2025-08-21 + +### Fixed + +- moved to `default` and `browser` exports from `node` and `default`, to support typescript module resolution + ## [0.2.3] - 2025-03-06 ### Changed diff --git a/packages/ssr/package.json b/packages/ssr/package.json index ebfd99d..f3e4ea6 100644 --- a/packages/ssr/package.json +++ b/packages/ssr/package.json @@ -1,7 +1,7 @@ { "name": "@asos/web-toggle-point-ssr", "description": "toggle point server side rendering code", - "version": "0.2.3", + "version": "0.2.4", "license": "MIT", "type": "module", "main": "./lib/main.es5.cjs", From a6039156f245bd3c406a695fce2e2059440924aa Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 23:15:38 +0100 Subject: [PATCH 19/24] support firefox in the globalFeaturesStore --- packages/features/docs/CHANGELOG.md | 1 + .../features/src/storeFactories/globalFeaturesStoreFactory.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/features/docs/CHANGELOG.md b/packages/features/docs/CHANGELOG.md index c53f151..1e1d071 100644 --- a/packages/features/docs/CHANGELOG.md +++ b/packages/features/docs/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved to named exports, to ensure that the "ssr" package is not a dependency, unless importing the `ssrBackedReactContextFeaturesStoreFactory` - This reverts to the intent of version [version 0.3.0](#030---2024-11-28), but not capitulating to ESLint's issues +- Support firefox by not using a `Symbol` as a `WeakMap` key (https://github.com/ASOS/web-toggle-point/issues/57) ### Changed diff --git a/packages/features/src/storeFactories/globalFeaturesStoreFactory.js b/packages/features/src/storeFactories/globalFeaturesStoreFactory.js index cccf561..9c9a4fc 100644 --- a/packages/features/src/storeFactories/globalFeaturesStoreFactory.js +++ b/packages/features/src/storeFactories/globalFeaturesStoreFactory.js @@ -12,7 +12,7 @@ const storeMap = new WeakMap(); * @returns {module:web-toggle-point-features.globalFeaturesStore} A store for features, held globally in the application. */ const globalFeaturesStoreFactory = () => { - const identifier = Symbol(); + const identifier = {}; /** * @name globalFeaturesStore * @memberof module:web-toggle-point-features From 0a698f36cb91059c6e741d100cfabf9322b25521 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 23:15:58 +0100 Subject: [PATCH 20/24] support de-structuring of the serialization object returned by the factory --- packages/ssr/docs/CHANGELOG.md | 1 + .../ssr/src/serializationFactory/index.js | 22 +++++++++++++------ .../src/serializationFactory/index.test.js | 12 ++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/packages/ssr/docs/CHANGELOG.md b/packages/ssr/docs/CHANGELOG.md index aa0509e..2d4b99d 100644 --- a/packages/ssr/docs/CHANGELOG.md +++ b/packages/ssr/docs/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - moved to `default` and `browser` exports from `node` and `default`, to support typescript module resolution +- support de-structuring of the serialization object returned by the serialization factory, via changed use of `this` ## [0.2.3] - 2025-03-06 diff --git a/packages/ssr/src/serializationFactory/index.js b/packages/ssr/src/serializationFactory/index.js index c3e6794..cf08654 100644 --- a/packages/ssr/src/serializationFactory/index.js +++ b/packages/ssr/src/serializationFactory/index.js @@ -1,6 +1,14 @@ import jsesc from "jsesc"; import parse from "html-react-parser"; +const getScriptMarkup = (id, { content }) => { + return ``; +}; + + // eslint-disable-next-line prettier/prettier, no-empty -- https://github.com/babel/babel/issues/15156 {} /** @@ -53,14 +61,14 @@ const serializationFactory = ({ id, logWarning }) => * @param {object} content The JSON content to be serialized. * @returns {string} A string containing markup for a type="application/json" script element with the specified content. */ - getScriptMarkup({ content }) { - return ``; - }, + getScriptMarkup: getScriptMarkup.bind(null, id), + /** + * @memberof module:web-toggle-point-ssr.serialization + * @param {object} content The JSON content to be serialized. + * @returns {external:React.Component} A react component for rendering a type="application/json" script element with the specified content. + */ getScriptReactElement(...args) { - return parse(this.getScriptMarkup(...args)); + return parse(getScriptMarkup.apply(null, [id, ...args])); }, getJSONFromScript() { const input = document.querySelector(`#${id}`)?.textContent; diff --git a/packages/ssr/src/serializationFactory/index.test.js b/packages/ssr/src/serializationFactory/index.test.js index 7bcd23b..1535af1 100644 --- a/packages/ssr/src/serializationFactory/index.test.js +++ b/packages/ssr/src/serializationFactory/index.test.js @@ -27,7 +27,8 @@ describe("serializationFactory", () => { let result; beforeEach(() => { - result = serialization.getScriptMarkup({ content }); + const { getScriptMarkup } = serialization; + result = getScriptMarkup({ content }); }); it("should return a string containing a JSON script tag, appropriately quoted by jsesc", () => { @@ -44,8 +45,9 @@ describe("serializationFactory", () => { describe("when rendering a scriptReactElement with React", () => { let result; beforeEach(() => { + const { getScriptReactElement } = serialization; ({ container: result } = render( - serialization.getScriptReactElement({ content }) + getScriptReactElement({ content }) )); }); @@ -69,8 +71,9 @@ describe("serializationFactory", () => { describe("when a valid JSON string is passed", () => { beforeEach(() => { + const { getJSONFromScript } = serialization; document.body.innerHTML = ``; - result = serialization.getJSONFromScript(); + result = getJSONFromScript(); }); afterEach(() => { @@ -88,8 +91,9 @@ describe("serializationFactory", () => { describe("when an invalid JSON string is passed", () => { beforeEach(() => { + const { getJSONFromScript } = serialization; document.body.innerHTML = ``; - result = serialization.getJSONFromScript(); + result = getJSONFromScript(); }); it("should have logged a warning", () => { From ce1e34931baaec122a0dc1657c4ca5f839eb553c Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Thu, 21 Aug 2025 23:19:32 +0100 Subject: [PATCH 21/24] lint --- packages/ssr/src/serializationFactory/index.js | 1 - packages/ssr/src/serializationFactory/index.test.js | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/ssr/src/serializationFactory/index.js b/packages/ssr/src/serializationFactory/index.js index cf08654..f6addae 100644 --- a/packages/ssr/src/serializationFactory/index.js +++ b/packages/ssr/src/serializationFactory/index.js @@ -8,7 +8,6 @@ const getScriptMarkup = (id, { content }) => { })}`; }; - // eslint-disable-next-line prettier/prettier, no-empty -- https://github.com/babel/babel/issues/15156 {} /** diff --git a/packages/ssr/src/serializationFactory/index.test.js b/packages/ssr/src/serializationFactory/index.test.js index 1535af1..ce72ef8 100644 --- a/packages/ssr/src/serializationFactory/index.test.js +++ b/packages/ssr/src/serializationFactory/index.test.js @@ -46,9 +46,7 @@ describe("serializationFactory", () => { let result; beforeEach(() => { const { getScriptReactElement } = serialization; - ({ container: result } = render( - getScriptReactElement({ content }) - )); + ({ container: result } = render(getScriptReactElement({ content }))); }); it("should return a react element containing a JSON script tag, appropriately quoted by jsesc", () => { From 5c6b11f22507a6a0f89f17c91160156a173bf11d Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:08:39 +0100 Subject: [PATCH 22/24] fixup for windows base image playwright snapshot false negative --- examples/serve/docs/CHANGELOG.md | 3 ++- examples/serve/playwright.config.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/serve/docs/CHANGELOG.md b/examples/serve/docs/CHANGELOG.md index e98c82f..68a95fc 100644 --- a/examples/serve/docs/CHANGELOG.md +++ b/examples/serve/docs/CHANGELOG.md @@ -14,12 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - import types explicitly from `@playwright/test` after unexpected pipeline failure +- loosened playwright image snapshot [max pixel difference ratio](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-max-diff-pixel-ratio) to 0.1, after [new windows false-negative](https://github.com/ASOS/web-toggle-point/actions/runs/18037892128/job/51329062944) (with a bit of headroom) ## [0.2.6] - 2025-07-14 ### Changed -- updated to use `variantGlobs` array, with updated webpack plugin [0.8.0][version 0.8.0](../../../packages/webpack/docs/CHANGELOG.md#080---2025-05-27) +- updated to use `variantGlobs` array, with updated webpack plugin [version 0.8.0](../../../packages/webpack/docs/CHANGELOG.md#080---2025-05-27) ## [0.2.5] - 2025-07-14 diff --git a/examples/serve/playwright.config.ts b/examples/serve/playwright.config.ts index 1b73718..c513112 100644 --- a/examples/serve/playwright.config.ts +++ b/examples/serve/playwright.config.ts @@ -3,9 +3,9 @@ import baseConfig from "../../test/automation/base.config"; const config: PlaywrightTestConfig = { ...baseConfig, - expect:{ + expect: { toMatchSnapshot: { - maxDiffPixelRatio: 0.05 + maxDiffPixelRatio: 0.1 } }, testDir: "./src/fixtures", From 6ed3e8242facceaaf794bda880b9a9b548670266 Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:37:19 +0100 Subject: [PATCH 23/24] revert maxDiffPixel change use new image for windows --- examples/serve/docs/CHANGELOG.md | 2 +- examples/serve/playwright.config.ts | 2 +- .../-screenshots-pride-chromium-win32.png | Bin 5015 -> 4426 bytes 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/serve/docs/CHANGELOG.md b/examples/serve/docs/CHANGELOG.md index 68a95fc..c64642e 100644 --- a/examples/serve/docs/CHANGELOG.md +++ b/examples/serve/docs/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - import types explicitly from `@playwright/test` after unexpected pipeline failure -- loosened playwright image snapshot [max pixel difference ratio](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-max-diff-pixel-ratio) to 0.1, after [new windows false-negative](https://github.com/ASOS/web-toggle-point/actions/runs/18037892128/job/51329062944) (with a bit of headroom) +- updated pride image after update to windows chromium emojis ## [0.2.6] - 2025-07-14 diff --git a/examples/serve/playwright.config.ts b/examples/serve/playwright.config.ts index c513112..c0c3006 100644 --- a/examples/serve/playwright.config.ts +++ b/examples/serve/playwright.config.ts @@ -5,7 +5,7 @@ const config: PlaywrightTestConfig = { ...baseConfig, expect: { toMatchSnapshot: { - maxDiffPixelRatio: 0.1 + maxDiffPixelRatio: 0.07 } }, testDir: "./src/fixtures", diff --git a/examples/serve/src/fixtures/event/playwright.spec.ts-snapshots/-screenshots-pride-chromium-win32.png b/examples/serve/src/fixtures/event/playwright.spec.ts-snapshots/-screenshots-pride-chromium-win32.png index 758710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ZAX7)e`yj3$aw|Ks+4Fv5xH-MSh3jm~8GEcUYR(G87%lx=j5kvIdVY^s+ox_K-@ho{+)7O4C-P~|8bE50*mHQ z08;EE$A)hyJKOk+$1?u(yC!dE_&7{Po~7w*S4*uAfcs+q7du}sdL(Q%+v?S;b8>Pb zdJcjvQEzhU7uxj34m}|E*kwgO-JsVr>#EwXMBt(;;O4IwOi{J+I_H+-4JTT>QPy8} z?%adF|LyZ{zrhRs-uBXx4@y5h(5GHW{Oi*X-BFnE=ASoq8$bQ~zWVcL2d-knh7D$5 z(Y$$Xr*mM>+O1pP1U@M&?5eD6-mpQrlD{Sj{QCPnQy{&(;R+#mr+Q$69u%%zf#lRb znWyi9esOEq;w{mSK)-Omu3n|cWq5_NZ$)$1h*LeE06%b#;;6g2ssPFUI85>u23F zbJM0xr;ePCxFm~)*bm5J#25ro3Fhs$-~Rer5+laf!nN(ak+Wp`_U%&?h5LrjoX3c9 zE%;5*vn>s+0CLCVT$6y2_b@SH#ONlrhlvqm5X1x%BgP(Psbv002ovPDHLkV1mwJwR`{o From a68e792653b659031d3a2747a658c54d004cffec Mon Sep 17 00:00:00 2001 From: TomStrepsil <10725179+TomStrepsil@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:42:00 +0100 Subject: [PATCH 24/24] 0.07 -> 0.05 --- examples/serve/playwright.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/serve/playwright.config.ts b/examples/serve/playwright.config.ts index c0c3006..828417c 100644 --- a/examples/serve/playwright.config.ts +++ b/examples/serve/playwright.config.ts @@ -5,7 +5,7 @@ const config: PlaywrightTestConfig = { ...baseConfig, expect: { toMatchSnapshot: { - maxDiffPixelRatio: 0.07 + maxDiffPixelRatio: 0.05 } }, testDir: "./src/fixtures",