{"id":21593688,"url":"https://github.com/yyz945947732/cnscript","last_synced_at":"2025-03-18T10:41:24.507Z","repository":{"id":195952014,"uuid":"693940066","full_name":"yyz945947732/cnscript","owner":"yyz945947732","description":"CnScript is language (actually don't) that transpiles to JavaScript.","archived":false,"fork":false,"pushed_at":"2023-09-21T04:44:41.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-26T09:40:37.745Z","etag":null,"topics":["chinese","custom-script","javascript","language","subset","your-script"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cnscript","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yyz945947732.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-20T02:41:24.000Z","updated_at":"2023-09-20T09:36:41.000Z","dependencies_parsed_at":"2023-09-20T09:01:06.528Z","dependency_job_id":null,"html_url":"https://github.com/yyz945947732/cnscript","commit_stats":null,"previous_names":["yyz945947732/cnscript"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyz945947732%2Fcnscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyz945947732%2Fcnscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyz945947732%2Fcnscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yyz945947732%2Fcnscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yyz945947732","download_url":"https://codeload.github.com/yyz945947732/cnscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244206676,"owners_count":20416086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese","custom-script","javascript","language","subset","your-script"],"created_at":"2024-11-24T17:14:02.555Z","updated_at":"2025-03-18T10:41:24.485Z","avatar_url":"https://github.com/yyz945947732.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CNScript\n\nCNScript is language (actually don't) that transpiles to JavaScript.\nThis code is created with the help of [your-script](https://github.com/iamfrontender/your-script) module.\n\nThe source files in CNScript have `.cns` extension.\n\n## Disclaimer\n\nThis module is created just for enormous incredible fun, nothing more. I can't even imagine someone really writing programms on this subset.\n\n## Usage\n\nThis module is distributed via npm, it requires global installation, run `npm i -g cnscript` just where you want this code.\nCNScript provides minimal console tool to translate source files to JavaScript and vice versa.\nAfter installed globally it availble in your wd as `cnscript`\n\nRun `cnscript yourFile.js` or `cnscript yourFile.cns` to translate it to opposite subset.\n\n## Example\n\nLets imagine, your JS file, `programm.js` contains following code:\n\n```javascript\nlet x = 10;\n\nfunction createFunction1() {\n  const x = 20;\n  return new Function(\"return x;\");\n}\n\nfunction createFunction2() {\n  const x = 20;\n  function f() {\n    return x;\n  }\n  return f;\n}\n\nconst f1 = createFunction1();\nconsole.log(f1());\nconst f2 = createFunction2();\nconsole.log(f2());\n```\n\nAfter launching `cnscript programm.js` in directory with this file, parser will create transpiled source file, `programm.cns`, translated in CNScript and look as following:\n\n```javascript\n变量 x = 10;\n\n函数 createFunction1() {\n  常量 x = 20;\n  返回 实例化 Function(\"return x;\");\n}\n\n函数 createFunction2() {\n  常量 x = 20;\n  函数 f() {\n    返回 x;\n  }\n  返回 f;\n}\n\n常量 f1 = createFunction1();\nconsole.log(f1());\n常量 f2 = createFunction2();\nconsole.log(f2());\n```\n\n## What it is and what isn't\n\nSince CNScript is based on your-scipt, this subset is limited by modifying the language keywords. So, any global object properties, like `document.body` or `HTMLElement.prototype.nextElementSibling` are untouched, though it's definetely possible :)\n\n## Under the hood\n\n[your-script](https://github.com/iamfrontender/your-script)\n[esprima-custom-keywords](https://github.com/iamfrontender/esprima-custom-keywords)\n[keywords-provider](https://github.com/iamfrontender/keywords-provider)\n\nCheers!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyz945947732%2Fcnscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyyz945947732%2Fcnscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyyz945947732%2Fcnscript/lists"}