mobx 6.11.0-pre → 6.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/dist/mobx.cjs.development.js +8 -11
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +8 -11
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +8 -11
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +8 -11
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/dist/types/observableobject.d.ts +0 -1
- package/package.json +1 -1
- package/src/api/decorators.ts +5 -1
- package/src/api/observable.ts +1 -0
- package/src/types/observableannotation.ts +12 -12
- package/src/types/observableobject.ts +0 -16
package/dist/mobx.esm.js
CHANGED
|
@@ -417,7 +417,7 @@ function is20223Decorator(context) {
|
|
|
417
417
|
}
|
|
418
418
|
function assert20223DecoratorType(context, types) {
|
|
419
419
|
if (process.env.NODE_ENV !== "production" && !types.includes(context.kind)) {
|
|
420
|
-
die("
|
|
420
|
+
die("The decorator applied to '" + String(context.name) + "' cannot be used on a " + context.kind + " element");
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -915,24 +915,21 @@ function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
|
915
915
|
}
|
|
916
916
|
function decorate_20223_$4(desc, context) {
|
|
917
917
|
if (process.env.NODE_ENV !== "production") {
|
|
918
|
-
|
|
918
|
+
if (context.kind === "field") {
|
|
919
|
+
throw die("Please use `@observable accessor " + String(context.name) + "` instead of `@observable " + String(context.name) + "`");
|
|
920
|
+
}
|
|
921
|
+
assert20223DecoratorType(context, ["accessor"]);
|
|
919
922
|
}
|
|
920
923
|
var ann = this;
|
|
921
924
|
var kind = context.kind,
|
|
922
|
-
name = context.name
|
|
923
|
-
addInitializer = context.addInitializer;
|
|
924
|
-
// Backwards/Legacy behavior, expects makeObservable(this)
|
|
925
|
-
if (kind == "field") {
|
|
926
|
-
addInitializer(function () {
|
|
927
|
-
storeAnnotation(this, name, ann);
|
|
928
|
-
});
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
925
|
+
name = context.name;
|
|
931
926
|
// The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:
|
|
932
927
|
// `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).
|
|
933
928
|
// This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot
|
|
934
929
|
// before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member
|
|
935
930
|
// from an object whose class did not declare it` error.
|
|
931
|
+
// TODO: it seems that this will not be required anymore in the final version of the spec
|
|
932
|
+
// See TODO: link
|
|
936
933
|
var initializedObjects = new WeakSet();
|
|
937
934
|
function initializeObservable(target, value) {
|
|
938
935
|
var _ann$options_$enhance, _ann$options_;
|