theiviaxx / PSLib

Photoshop CommonJS modules
48 stars 5 forks source link

Not working currently #1

Closed SturmB closed 6 years ago

SturmB commented 6 years ago

Thank you for creating this library to add require() functionality to Adobe ExtendScript.

Unfortunately, I tried cloning this repo and following your instructions in the README, plus un-commenting the final section of require.jsx to actually run the tests. Sadly, I did not get a successful execution. The ESTK console returns:

Could not load name 1.0/absolute/program
Could not load name 1.0/cyclic/program
Could not load name 1.0/determinism/program
Could not load name 1.0/exactExports/program
Could not load name 1.0/hasOwnProperty/program
Could not load name 1.0/method/program
Could not load name 1.0/missing/program
Could not load name 1.0/monkeys/program
Could not load name 1.0/nested/program
Could not load name 1.0/relative/program
Could not load name 1.0/transitive/program
Result: undefined

Any idea on what could be happening here and how to remedy it?

theiviaxx commented 6 years ago

Sorry for the late reply. I have been using this in production for the past several years, let me see if i made some modifications that havent been pushed

SturmB commented 6 years ago

Not a big deal. I was able to get the AES (Adobe ExtendScript) side of my Adobe CEP project to work with modules by leveraging TypeScript's namespacing capability. Although it would probably be nicer to have proper require() functionality instead.

Yeah, I'm trying to create an extension to Adobe Illustrator with Adobe CEP and, to complicate matters, I am attempting to do so with TypeScript so I can leverage its advantages over plain JS. Feel free to have a look at the project, if you wish. I'm using SystemJS on the HTML Panel side, but that clearly doesn't work on the AES side.

theiviaxx commented 6 years ago

Ok i pushed the version i've been using. There were a couple small changes in there that might do the trick. Let me know if it still doesn't work.

SturmB commented 6 years ago

I pulled the repo to get the latest, un-commented the // Tests function at the end of require.jsx and ran it in the ESTK for Photoshop CC 2018.

Same errors.

That makes no sense that it's working well for you, but not for me, unless there's something that needs to be changed about how it's calling those "name"s or perhaps even in the tests themselves.

theiviaxx commented 6 years ago

I havent run those tests in quite some time, but require.jsx works as expected. I've added #2 to get those working.

Can you try running main.jsx in the following?

main.jsx

#include require.jsx

(function() {
    var m = require("mod");
    m.doit();
})()

mod.jsx

(function() {
    exports = module.exports = {
        doit: function() {
            alert("Works");
        }
    };
})()
SturmB commented 6 years ago

Success. That test with main.jsx and mod.jsx does, indeed, throw the alert window. Now I'll have to see whether or not I can implement this into my TypeScript/Adobe CEP projects. 😣

theiviaxx commented 6 years ago

You might have to make a d.ts file for the api and make sure your tsconfig is targeting like es3 or something

SturmB commented 6 years ago

Sounds good. It'll be quite some time before I can properly give this a try (just got a bunch of work dropped into my lap), but I'll see if I can report back when I do. Thanks again!