- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
1.5 KiB
get-nonce
just returns a nonce (number used once). No batteries included in those 46 bytes of this library.
- ✅ build in
webpacksupport via__webpack_nonce__
API
getNonce(): string|undefined- returns the currentnoncesetNonce(newValue)- set's nonce value
Why?
Why we need a library to access __webpack_nonce__? Abstractions!
"I", as a library author, don't want to "predict" the platform "you" going to use.
"I", as well, want an easier way to test and control nonce value.
Like - nonce is supported out of the box only by webpack, what you are going to do?
This is why this "man-in-the-middle" was created.
Yep, think about left-pad :)
Webpack
To activate the feature set a webpack_nonce variable needs to be included in your entry script.
__webpack_nonce__ = uuid(); // for example
Without webpack __webpack_nonce__ is actually just a global variable,
which makes it actually bundler independent,
however "other bundlers" are able to replicate it only setting it as a global variable
(as here in tests) which violates a "secure" nature of nonce.
get-nonce is not global.
Used in
react-style-singleton<-react-remove-scroll<-react-focus-on
Inspiration
Licence
MIT