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
|
@@ -416,7 +416,7 @@ function is20223Decorator(context) {
|
|
|
416
416
|
}
|
|
417
417
|
function assert20223DecoratorType(context, types) {
|
|
418
418
|
if ( !types.includes(context.kind)) {
|
|
419
|
-
die("
|
|
419
|
+
die("The decorator applied to '" + String(context.name) + "' cannot be used on a " + context.kind + " element");
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
|
|
@@ -914,24 +914,21 @@ function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
|
914
914
|
}
|
|
915
915
|
function decorate_20223_$4(desc, context) {
|
|
916
916
|
{
|
|
917
|
-
|
|
917
|
+
if (context.kind === "field") {
|
|
918
|
+
throw die("Please use `@observable accessor " + String(context.name) + "` instead of `@observable " + String(context.name) + "`");
|
|
919
|
+
}
|
|
920
|
+
assert20223DecoratorType(context, ["accessor"]);
|
|
918
921
|
}
|
|
919
922
|
var ann = this;
|
|
920
923
|
var kind = context.kind,
|
|
921
|
-
name = context.name
|
|
922
|
-
addInitializer = context.addInitializer;
|
|
923
|
-
// Backwards/Legacy behavior, expects makeObservable(this)
|
|
924
|
-
if (kind == "field") {
|
|
925
|
-
addInitializer(function () {
|
|
926
|
-
storeAnnotation(this, name, ann);
|
|
927
|
-
});
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
924
|
+
name = context.name;
|
|
930
925
|
// The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:
|
|
931
926
|
// `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).
|
|
932
927
|
// This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot
|
|
933
928
|
// before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member
|
|
934
929
|
// from an object whose class did not declare it` error.
|
|
930
|
+
// TODO: it seems that this will not be required anymore in the final version of the spec
|
|
931
|
+
// See TODO: link
|
|
935
932
|
var initializedObjects = new WeakSet();
|
|
936
933
|
function initializeObservable(target, value) {
|
|
937
934
|
var _ann$options_$enhance, _ann$options_;
|