extendscript / extendscriptr Goto Github PK
View Code? Open in Web Editor NEWAn 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
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
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.
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"
}
}
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;
}
}
}
We should move ASAP from https://github.com/fabianmoronzirfas/extendscript.prototypes to https://github.com/ExtendScript/extendscript-es5-shim as soon as it is set up
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?
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
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.
The current version doesn't have a polyfill for Object.assign
, looks like it's using an older version of https://github.com/fabianmoronzirfas/extendscript.prototypes ?
Maybe this will be addressed in #24?
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
I wrote a proof of concept compilation but get an error in InDesign see my tests here.
Maybe it helps
https://github.com/fabiantheblind/extendscript6-proof-of-concept
npm publish
crate new account on https://www.npmjs.com/
Follow the steps here:
https://medium.com/@jdaudier/how-to-create-and-publish-your-first-node-js-module-444e7585b738#.mo2f6tz3s
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
Not sayin' this necessarily needs to be built into extendscriptr, but even examples of a watch workflow would be helpful.
I would love if the dependencies would be as low as possible.
browserify, babelify, gulp, all that. Creates new problems. Where possible we should use code we've written ourselves. e.g.
What if we set in package.json
"main":"basil.bundle.js"
can we call it just like any other module?
extendscriptr/test/src/illustrator.js
Line 27 in 20ba75c
When the font is not active it creates an error.
Could you role this back? @lumenn
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 ?
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?
I was curious which ES5 and ES6 features are supported and which not.
I also found this other project: https://github.com/fusepilot/babel-preset-extendscript
Maybe you should work together :)
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
I am doing something wrong but I don't know what yet. Configuring babelify with browserify is a real headache! :(
with parameters like:
@fabiantheblind Any idea how to do this? Never done this before.
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.
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?
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
It would be great to be able to watch a whole directory and compile all js/jsx files in that directory. Like other bundlers do and like it was requested in #31 by @florianbepunkt
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?
Does it still work if there is a #include
in a sub file?
I snooped around the polyfills and there is a big problem with the word document. In InDesign document is a type. :-(
When I run the test script in ID I get an error that defineProperty is undefined. I think the polyfill for it needs to be included in the bundled script before anything else.
I'll make a test later on or tomorrow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.