@thisisagile/easy-react 20.1.0 → 20.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -280,3 +280,14 @@ The `@requires` decorator group also contains `@requires.labCoat()` this decorat
280
280
 
281
281
  To use these decorators, the generic `security` middleware must be loaded first. In most cases, it should be added to the `pre` list of handlers of a service.
282
282
  The security middleware takes an optional configuration object, which is documented [in code](packages/easy-express/src/express/SecurityHandler.ts).
283
+
284
+ ## Side effects and tree shaking
285
+ Every package declares `sideEffects` in its `package.json`, so a bundler only keeps the modules a consumer actually uses. Contributors keep that declaration true by following these rules:
286
+
287
+ - **No module-level mutation of anything outside the module.** Do not patch globals, prototypes or imported objects when a module loads. If something must be configured, configure it in the module that needs it, so it is kept exactly when that module is used.
288
+ - **Catalogue values are pure factories.** Build enum and catalogue values with plain constructors or factory calls that only create objects, so an unused value can be dropped.
289
+ - **A module that must run for its effect on import is listed explicitly.** `easy-test` lists its index and matcher files because `import '@thisisagile/easy-test'` exists to call `expect.extend`. `easy-test-react` lists its index because importing it mocks the timezone. Runtime packages declare `false`.
290
+ - **`DateTime` and `Meta` are deliberately not listed.** `DateTime` extends Day.js and `Meta` loads `reflect-metadata` at module level, but only their own exports need that setup. Bundlers keep a module's top-level code whenever any of its exports are used, so they stay correct unlisted. Listing them would make every root import, such as `isDefined`, pay for Day.js and `reflect-metadata`.
291
+ - **No `emitDecoratorMetadata`.** Nothing in easy reads `design:` metadata; decorators store what they need under their own keys.
292
+
293
+ `test/bundle/workspaces.mjs` checks these rules against the packed packages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-react",
3
- "version": "20.1.0",
3
+ "version": "20.1.2",
4
4
  "description": "Straightforward library building micro applications in react",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "next": "^15.5.28"
50
50
  },
51
51
  "dependencies": {
52
- "@thisisagile/easy": "^20.1.0",
52
+ "@thisisagile/easy": "^20.1.2",
53
53
  "react": "^18.3.1",
54
54
  "react-dom": "^18.3.1",
55
55
  "sass": "^1.80.3"