Closed JairusSW closed 1 year ago
I can't seem to reproduce this. I added a.js
and b.js
to the root of my test project:
// ====== a.js ======
console.log("Transform A loaded")
export default class TransformA {
constructor() {
console.log("Transform A constructed")
}
}
// ====== b.js ======
console.log("Transform B loaded")
export default class TransformB {
constructor() {
console.log("Transform B constructed")
}
}
Then I invoked yarn asc assembly/index.ts --transform ./a --transform ./b
with my current directory being the root of the project. The output was exactly as expected:
yarn run v1.22.19
$ C:\Users\MrYou\projects\as-stuff\testproject\node_modules\.bin\asc assembly/index.ts --transform ./a --transform ./b
Transform A loaded
Transform B loaded
Transform A constructed
Transform B constructed
Done in 1.08s.
This was tested using the main branch. What's inside your asconfig.json
?
I just added c.js
to my test project and tested "transform": "./c"
and "transform": ["./c"]
in asconfig.json
and it still works as expected. I'm wondering if it's actually an issue with resolving the path.
@dcodeIO thought that it was a problem with path resolution (https://discord.com/channels/721472913886281818/1052758039444332544/1052911832383369287), but I think not.
I moved both transform files to my root directory also and named them tbs.js
and json.js
with my asconfig
set to
"transform": [
"./json",
"./tbs"
]
After building, ./json.js
was not instantiated. Maybe it is something to do with decorators since they are both triggered by decorators? Possibly even a problem with visitor-as
. I'll do my best to diagnose it.
Here's the project where this is occurring: https://github.com/JairusSW/as-tbs/blob/master/assembly/test.ts#L8
You should make sure both of those files are loaded. Replace their contents with something like console.log("loaded!"); export default class { constructor() { console.log("constructed!") } }
. That's a surefire way to know if it's visitor-as
's fault.
Aha! They both are used. Its with visitor-as
. Taking a look now
I simply used a BaseTransform
and added a check to see if the class on visitClassDeclaration
had the correct decorator. I'll move this issue to visitor-as
and perhaps open a PR when I find the issue. Thanks, Blum!
Hello! It seems that when you provide two transform flags to
asc
, the second one is used and not the first. So if I had a transform tojson-as/transform
(package.json points tojson-as/transform/lib/index.js
) and./transform
(again, package.json points to./transform/lib/index.js
) only./transform
is applied instead of both.Having this triggers
json-as
but not./transform
asc assembly/test.ts --target test --transform ./transform --transform json-as/transform
Flipping it results in the opposite
asc assembly/test.ts --target test --transform json-as/transform --transform ./transform