https://developers.google.com/apps-script/guides/v8-runtime/migration
Do you have any plan to support less-transformed codes for v8 runtime?
@shinout I only started experimenting with how V8 runtime works.
At the @google/clasp level, it could be nice to be able to get/set which runtime to use in the appsscript.json
For the Typescript compilation, ts2gas should not be hard to modify in order to support a flag which instruct build for rhino or v8.
I'm open to design suggestions as well as PR.
Most urgently, I'd like to get a more detailed overview of which exact features are supported (something like https://node.green/)
Your plan sounds great. Then, how we collect the enabled ESnext features is the concern. Manually checking every feature, or asking GAS developers about it. I'm wondering this clasp project is google's official and some maintainers are internal google people, aren't they? If so, they should know the exact features.
I tried to push some codes written in ESNext format to GAS.
The result was 400 error. It seems that GAS currently doesn't accept modern JS format via HTTP. I don't know to whom I should request to include this new feature. Any idea?
For reference, I've put up this spreadsheet about supported features and it is fine up to ES2019.
https://docs.google.com/spreadsheets/d/1JIJac5lsS2d1Gm7u8Zk-cLAaGLIxh_wVlU44Iez96bU/edit?usp=sharing
Currently @google/clasp should be able to read the compilerOptions from your tsconfig.json and to pass them to ts2gas.
https://github.com/google/clasp/blob/e1ed852e6bc0d7f5e33f6bbcfef62e2324d8294c/src/files.ts#L59-L66
So once ts2gas is changed to no longer force target to ES3, there should be little to change in @google/clasp.
Some documentation probably. ES3 is mentionned twice in https://github.com/google/clasp/blob/master/docs/typescript.md#how-it-works
ts2gas PR https://github.com/grant/ts2gas/pull/47 is ready for @grant to review and release.
After that, a minor @google/clasp PR (mostly documentation) prior a new release.
@PopGoesTheWza Thanks you so much for your thorough function checking!
By the way, have you encountered 400 error when you push codes whose target is ES2019? I tried to push such codes to GAS by locally manipulating ts2gas's target, and got the error.
If so, we have to wait for a new release by Google supporting ESNext grammar via HTTP.
@shinout I was able to succesfully clasp push ES2019 code on first attempt with no issue. What I did (on an existing sample project) was:
@google/clasp from PR #739 clasp open the project and activate V8 onlineappsscript.json and the update the local manifesttsconfig.json with "target": "ES2019"Thus basic V8 support is confirmed and we could advance with:
@google/clasplerna or rush when dealing with many GAS projects but I am willing to work on it with youappsscript.json and provide the appropriate es3/es2019 default target to ts2gastarget from local tsconfig.json and warn if it does not match engine from local appsscriptappsscript.json when using some commands like create, pull, pushI also tried to use #739 and work fine!
@shinout According to @PopGoesTheWza and my investigation, at least, the condition that the REST API rejects is not whether source codes are ES2019 or not. The real condition is still in mystery.
502 git clone https://github.com/google/clasp.git --depth=100
503 cd clasp
504 git remote add PopGoesTheWza https://github.com/PopGoesTheWza/clasp.git
505 git remote set-branches PopGoesTheWza V8-engine-support
510 git fetch PopGoesTheWza
511 git checkout -b V8-engine-support PopGoesTheWza/V8-engine-support
512 npm ci
513 npm run build-local
515 npm pack
https://github.com/yumetodo/gmail2mastodon
tsconfig.json with "target": "ES2019"$npm i ../clasp/google-clasp-2.3.0.tgz
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
+ @google/[email protected]
added 10 packages from 7 contributors, removed 3 packages, updated 5 packages and audited 707 packages in 15.423s
9 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$npm run deploy
> [email protected] deploy C:\msys64\home\yumetodo\gmail2mastodon
> clasp push
鈹斺攢 src/appsscript.json
鈹斺攢 src/index.ts
Pushed 2 files.

Maybe some of my codes include unacceptable grammar for Google. I'll specify it.
@yumetodo out of curiosity, the Object.defineProperty... with __esModule comes from your .ts source code right? May I ask about its purpose?
@PopGoesTheWza esModuleInterop is on by default so that that has appeared, I supposed.
My source code used at the picture is:
https://github.com/yumetodo/gmail2mastodon/blob/5ce7d8fa1aa6a3697048855266d5cf39148cc9fd/src/index.ts
Keeping this open until next release.
@yumetodo this is odd, for ts2gas should filter out such statement.
@PopGoesTheWza Really!? Have you ever tried to reproduce my step?
I've just used the clasp of #739 version.
@shinout any updates?
Can you test with the #791 unofficial release?
npm uninstall -g @google/clasp && npm install -g forked-clasp
clasp --version
# should be 2.4.0 or more
Try replacing @google/clasp 2.3.0 with forked-clasp which is more advanced.
npm uninstall -g @google/clasp
npm install -g forked-clasp
Most helpful comment
@shinout I only started experimenting with how V8 runtime works.
At the
@google/clasplevel, it could be nice to be able to get/set which runtime to use in theappsscript.jsonFor the Typescript compilation,
ts2gasshould not be hard to modify in order to support a flag which instruct build for rhino or v8.I'm open to design suggestions as well as PR.
Most urgently, I'd like to get a more detailed overview of which exact features are supported (something like https://node.green/)