Skip to content

Releases: canjs/can-migrate

Inline define-map static properties to ObservableObject and split chained variables declarations

23 Jan 17:07
Compare
Choose a tag to compare
  • Transforms inline DefineMap to ObservableObject. #157

  • Split chained variable declaration (var, const and let) if DefineMap, DefineList or Component are in the declarations. #158

Inline DefineMap to ObservableObject and Component imports

09 Jan 19:15
Compare
Choose a tag to compare

Fixes:

  • Inline DefineMaps do not get converted to ObservableObject
  • Codemod renaming Component import does too much
  • Codemods do not handle can-component imported with another name

#151 #152 #153

Fixes for Observable objects and rest-model

30 Sep 20:17
d904844
Compare
Choose a tag to compare

Handle StacheElement when exported via module.export

02 Sep 16:53
Compare
Choose a tag to compare

This fixes an issue where

module.exports = Component.extend({
  tag: "my-app",
  view: `CanJS {{feels}} modules`,
  ViewModel: {
    feels: { default: "😍" }
  }
});

Was having issues with adding the customElements.define so now it should be:

module.exports = class MyApp extends StacheElement {
  static get view() {
    return `CanJS {{feels}} modules`;
  }

  static get props() {
    return {
      feels: { default: "😍" }
    };
  }
};
customElements.define('my-app', MyApp);

Also fixes issue with not converting require statements as there was only logic for import.

propertyDefaults for StacheElement & Remove Spread ObservableArray

02 Sep 18:27
Compare
Choose a tag to compare

Add creating propertyDefaults to StacheElement:

static get propertyDefaults() {
    return DeepObservable;
  }

For a StacheElement and remove the transform for ObservableArray that would transform DefineList([1, 2]) into ObservableArray(...[1, 2]) as the first parameter is now an array.

Transform `.mjs` files

02 Sep 18:28
Compare
Choose a tag to compare
Pre-release

Update the files that are transformed to work on .mjs files.

propertyDefaults to ObservableObject & ObservableArray

02 Sep 18:32
Compare
Choose a tag to compare

Add

static get propertyDefaults() {
  return DeepObservable;
}

to ObservableObject if propertyDefaults doesn't already exist and ObservableArray add:

static get items () {
  return DeepObservable;
}

if this doesn't already exist.

Rename to StacheElement, ObservableArray & ObservableObject

02 Sep 18:36
Compare
Choose a tag to compare

Update the transforms to use the new names, from
StacheDefineElement to StacheElement
DefineObject to ObservableObject
DefineArray to ObservableArray

Type convert custom types

02 Sep 18:39
Compare
Choose a tag to compare
Pre-release

This will convert custom types such as ObservableObject or ObservableArray with type.maybeConvert for less strict check.
Convert:

{
  elem: MyMap
}

into:

{
  elem: type.maybeConvert(MyMap)
}

transform default() into a getter

02 Sep 18:41
Compare
Choose a tag to compare
Pre-release

transform Defaults into getters

Replaces

{ prop: { Default: Todo } }

with

prop: {
  get  default () {
    return new Todo()
  }
}

Also fix issue with transforming setters into methods.