buxlabs / amd-to-es6

convert amd to es
MIT License
35 stars 17 forks source link

can transform cmd to es6? #127

Open Jeromy-L opened 3 years ago

Jeromy-L commented 3 years ago

can it also transform cmd to es6?

emilos commented 3 years ago

did you mean cjs (commonjs) ?

Jeromy-L commented 3 years ago

No,cmd  Such as seajs

------------------ Original ------------------ From: Emil Ajdyna <notifications@github.com> Date: Fri,Dec 4,2020 4:04 PM To: buxlabs/amd-to-es6 <amd-to-es6@noreply.github.com> Cc: Jeromy <843755624@qq.com>, Author <author@noreply.github.com> Subject: Re: [buxlabs/amd-to-es6] can transform cmd to es6? (#127)

emilos commented 3 years ago

hey @Jeromy-L

I haven't heard of cmd before, but it seems to look similar to simplified commonjs wrapping pattern, I have some specs for that.

https://github.com/buxlabs/amd-to-es6/blob/b74da71937677675eace536192e5e50d68a50bf2/test/fixture/amdjs-api/simplified-commonjs-wrapping/input.js https://github.com/buxlabs/amd-to-es6/blob/b74da71937677675eace536192e5e50d68a50bf2/test/fixture/amdjs-api/simplified-commonjs-wrapping-returns-literal/input.js

Examples from this page should be supported.

I'd recommend to just try it out on your project and see how it goes.

Jeromy-L commented 3 years ago

hey @Jeromy-L

I haven't heard of cmd before, but it seems to look similar to simplified commonjs wrapping pattern, I have some specs for that.

https://github.com/buxlabs/amd-to-es6/blob/b74da71937677675eace536192e5e50d68a50bf2/test/fixture/amdjs-api/simplified-commonjs-wrapping/input.js https://github.com/buxlabs/amd-to-es6/blob/b74da71937677675eace536192e5e50d68a50bf2/test/fixture/amdjs-api/simplified-commonjs-wrapping-returns-literal/input.js

Examples from this page should be supported.

I'd recommend to just try it out on your project and see how it goes.

i found that amd has such example, but you have not convert this one:   

require([module], callback);

emilos commented 3 years ago

@Jeromy-L could you please provide a full example? That would make it easier to add a new unit test for that case.

Jeromy-L commented 3 years ago

@Jeromy-L could you please provide a full example? That would make it easier to add a new unit test for that case.

such as require(['myModule'], function(myModule) { myModule.dosomthing() });