Giter Site home page Giter Site logo

extendscript / extendscriptr Goto Github PK

View Code? Open in Web Editor NEW
152.0 152.0 15.0 1.47 MB

An NPM command line tool to compile modern javascript (es5 & es6) into executable extendscript (es3)

License: Do What The F*ck You Want To Public License

JavaScript 100.00%

extendscriptr's People

Contributors

andyinabox avatar dependabot[bot] avatar fabiantheblind avatar ff6347 avatar gitter-badger avatar lumenn avatar semantic-release-bot avatar stefanomasini avatar vogelino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

extendscriptr's Issues

What is the best way to deal with array-like, but not true Array collections in Illustrator

I would like to use the forEach() function on app.activeDocument.pageItems, but it is not a proper Array. I tried to get around this by using Array.from(app.activeDocument.pageItems), but this does not appear to be an available function. I was successful using [].concat(app.activeDocument.pageItems). Is this the most efficient way to make pageItems into an Array? Is there a way to use forEach() with the non-Array, but array like collections in Illustrator?

Perhaps there should be a warning about these array like collections in the readme.

module-alias support

I've been unable to get extendscriptr to run in tandem with module-alias. My application is just the boilerplate, and I'd like to add module-alias so that I can better manage require paths as the application scales. Open to suggestions if I'm headed down an odd path or if this is the wrong communication channel. Thanks for taking the time.

app.js

// this errors when the jsx is run
require('module-alias/register')
$.writeln("@test")

// this runs, but "@test2" will be printed rather than "test2", suggesting moduleAlias didn't do its thing
const moduleAlias = require('module-alias')
moduleAlias.addAlias("@test2", "test2")
$.writeln("@test2")

package.json

{
    "scripts": {
        "setup": "mkdir dist ; touch dist/app.jsx",
        "build": "extendscriptr --script ./src/app.js --output ./dist/app.jsx"
    },
    "devDependencies": {
        "extendscriptr": "^1.2.6"
    },
    "dependencies": {
        "module-alias": "^2.2.2"
    },
    "_moduleAliases": {
        "@test": "test"
    }
}

for..of loop is not working

Hi everybody! I've got a issue about for...of... loop in my code.
Here is the things,

...

for ( let path of layer.pathItems ) {
    //do some stuff for this path
}

...

When I use for ... of loop , I got a an error like

Cannot execute script in target engine 'main'!
#54 Symbol is undefine

Here is the code , which is translated, about for of loop in my source code

      this.items = this.doc.pageItems;
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;

      try {
        for (var _iterator = this.doc.layers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var layer = _step.value;
          this[layer.name] = layer.groupItems;
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator["return"] != null) {
            _iterator["return"]();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }

The future

Hey guys, I really like what you have done with extendscriptr and it is amazing it took me so long to find/use it.

I like the general setup but now we have typescript I personally would like to use that.

Not sure if that fits in this repo, as not all users might want to use typescript. Therefore it might be better to start a new sister project called typescriptr

Do you have any thoughts on this?

Processing obfuscated code

Hi,
I'm doing what you could easily call stress-tests on extendscriptr :-) Let me explain first what I'm after – if you think this kind of discussion is better done elsewhere feel free to move this one where it should more appropriately belong.

Since JsxBin, how can I put it, may not be anymore as sealed as we used to think, I'm trying to find alternatives. JS Obfuscators are either scams (introducing unwanted http requests) or too aggressive to the ESTK taste, so the obfuscated code doesn't work at all when run, say, in Photoshop. Known fact that I proved years ago. Currently I'm testing javascriptobfuscator (free tier, the paid options are too much for my needs) and javascript2img. FYI, I've discarded Dan's Tools for their obfuscated code is perfectly de-obfuscated by their own Beautifier - good job :-)
Then there is Marc Autret JsxBlind.

Results vary, also depending on the source code itself – I'm planning to write an extensive article as soon as I've gathered enough data.

My possibly weird idea is to extendscriptr-ize the obfuscated code (that might rely on some ES5/6 unsupported features) hoping that Photoshop will like it better.

No way so far! Errors spring on javascript2img code for instance (the one I personally find the best obfuscation result ever), while less aggressive options for javascriptobfuscator work out of the box without the need to be extendscriptr-ized.

Suggestions / thoughts?
I've also tried to just manually prepend the Array shims that extendscriptr seems to add to the code, with no luck – apparently javascript2img code is plain indigestible. There is any other secret sauce that extendscriptr adds, that I can add myself manually if the CLI doesn't work?
Thanks guys!!

Davide

semantic-release sucks

Hi @vogelino having all that semantic-release/travis stuff in there sucks.

It gives me the following error

> [email protected] semantic-release /path/to/extendscript/extendscriptr
> semantic-release pre && npm publish && semantic-release post

semantic-release WARN pre semantic-release didn’t run on Travis CI and therefore a new version won’t be published.
semantic-release WARN pre You can customize this behavior using "verifyConditions" plugins: git.io/sr-plugins
semantic-release ERR! pre Failed to determine new version.
semantic-release ERR! pre ENOCHANGE There are no relevant changes, so no new version is released.

Babel deps check

npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated [email protected]: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers

global installation is not working because of hardcoded path of prototypes

Hi,
I've installed (apparently successfully, few warnings about unmet dependencies) extendscriptr, but when I try to run a simple:

$ extendscriptr --script ./test.js --output ./test_enc.js

I get this error:

Running extendscriptr with following options:
--script: ./test.js
--output: ./test_enc.js
--target: undefined (optional)
fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open './node_modules/extendscript.prototypes/lib/extendscript.prototypes.js'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Object.<anonymous> (/usr/local/lib/node_modules/extendscriptr/index.js:27:29)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:429:10)
    at startup (node.js:139:18)

Any idea about the reason why this occurs?
Thank you!

Davide

Watch mode

Not sayin' this necessarily needs to be built into extendscriptr, but even examples of a watch workflow would be helpful.

Feedback (and/or) extension

Hey, I'll need to use this extensively in inDesign for the 6 next months.
Would you be interested in a detailed weekly or monthly feedback as I'm progressing ?

Prependify issue

Hello there. I'm attempting to use this library in a basil.js project, and I'm getting the following error:

Running extendscriptr with following options:
--script: src/main.jsx
--output: index.jsx
--target: undefined (optional)
/[path]/node_modules/prependify/index.js:7
    text = text[Object.keys(text)[0]].join(' ')
                                      ^

TypeError: text[Object.keys(...)[0]].join is not a function
    at prependify (/[path]/node_modules/prependify/index.js:7:39)
    at Browserify.plugin (/[path]/node_modules/browserify/index.js:354:9)
    at /[path]/node_modules/browserify/index.js:100:14
    at Array.forEach (native)
    at new Browserify (/[path]/node_modules/browserify/index.js:99:44)
    at Browserify (/[path]/node_modules/browserify/index.js:39:47)
    at Object.<anonymous> (/[path]/node_modules/extendscriptr/index.js:39:9)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)

(I replaced the actual project path with [path] for privacy reasons)

Any ideas?

Understand and fix the Error in extendscript toolkit execution

The following line is marked as red and no information is shown in the console when executing the generated output:

$entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined

bildschirmfoto 2016-04-27 um 20 59 40

I am doing something wrong but I don't know what yet. Configuring babelify with browserify is a real headache! :(

Handle # statements

It would be nice if there was some way of addressing #target, #include, and maybe even #includepath here. Currently extendscriptr blows up when any of these are encountered.

A short-term fix would be to just ignore them, but it would be nice if #include could be translated to import. Not quite sure how #includepath would be best handled.

I came across this attempting to use extendscriptr with basil.js, it fails because of a single #target statement in the basil.js file.

Executing the outputted script with arguments though command line

I usually use global variable call arguments, which is an array can be used for passing arguments to the jsx file when I execute a script from command line, but extendscriptr outputted file can't be used for doing this, when I log this variable I got a function....
Then I came up with a quick solution, that is I put single line at top of outputted file with

var scriptArgs = arguments;

and I can access my command line arguments correctly with scriptArgs.
Dose anybody has better solution?

npm ERR! code ELIFECYCLE npm ERR! errno 1 on npm install

Hey guys, I have been trying to install ExtendScriptr but can't quite figure out what is going wrong with this. Most likely just me doing it wrong but you never know.

npm install extendscriptr --save-dev

[email protected] postinstall D:\PROGRAMMING\PROJECTS\VECTOR_OPS\node_modules\add-local-binaries-to-path
node index.js

Could not find any config files for bash, fish, or zsh!
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ian\AppData\Roaming\npm-cache_logs\2018-07-21T08_22_47_330Z-debug.log

extendscriptr: command not found

I've installed the library, but every time I try to run extendscriptr --script src/Layers_To_PNG.js --output dist/Layer_To_PNG_v2.jsx I get extendscriptr: command not found

node: 8.11.3
npm: 5.6.0

What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.