{"id":19343387,"url":"https://github.com/mo4islona/node-blockly","last_synced_at":"2025-04-06T03:10:09.762Z","repository":{"id":33932985,"uuid":"37656172","full_name":"mo4islona/node-blockly","owner":"mo4islona","description":"Blockly for Node.js and Browser via CommonJS module","archived":false,"fork":false,"pushed_at":"2022-12-08T19:23:14.000Z","size":6847,"stargazers_count":136,"open_issues_count":14,"forks_count":83,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T00:10:06.615Z","etag":null,"topics":["blockly","browser","commonjs","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mo4islona.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}},"created_at":"2015-06-18T11:43:07.000Z","updated_at":"2025-03-05T05:50:30.000Z","dependencies_parsed_at":"2023-01-15T03:31:06.174Z","dependency_job_id":null,"html_url":"https://github.com/mo4islona/node-blockly","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mo4islona%2Fnode-blockly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mo4islona%2Fnode-blockly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mo4islona%2Fnode-blockly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mo4islona%2Fnode-blockly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mo4islona","download_url":"https://codeload.github.com/mo4islona/node-blockly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["blockly","browser","commonjs","nodejs"],"created_at":"2024-11-10T03:38:10.760Z","updated_at":"2025-04-06T03:10:09.741Z","avatar_url":"https://github.com/mo4islona.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blockly for Node.js and Browser via CommonJS module\n\n![Build](https://travis-ci.org/mo4islona/node-blockly.svg?branch=master)\n\n\nSupports `JavaScript`, `PHP`, `Dart`, `Lua` and `Python` generators.\n\n[Live demo](http://mo4islona.github.io/blockly/) with async locales\n\n\n## Install\n```\nyarn add node-blockly\n```\n## Usage\n**Node.js**\n\nAll generators\n```js\nvar Blockly = require('node-blockly');\n```\nOr you may use standalone generators to decrease memory usage\n```js \nvar Blockly = require('node-blockly/lua');\n```\n\n**Browser**\n\nAll generators\n```js\nvar Blockly = require('node-blockly/browser');\n```\n\n## Example\n**Node.js**\n```js\nvar Blockly = require('node-blockly');\n\nvar xmlText = `\u003cxml xmlns=\"http://www.w3.org/1999/xhtml\"\u003e\n        \u003cblock type=\"variables_set\"\u003e\n            \u003cfield name=\"VAR\"\u003eblockly\u003c/field\u003e\n            \u003cvalue name=\"VALUE\"\u003e\n                \u003cblock type=\"text\"\u003e\n                    \u003cfield name=\"TEXT\"\u003eHello Node.js!\u003c/field\u003e\n                \u003c/block\u003e\n            \u003c/value\u003e\n        \u003c/block\u003e\n    \u003c/xml\u003e`;\n\ntry {\n    var xml = Blockly.Xml.textToDom(xmlText);\n}\ncatch (e) {\n    console.log(e);\n    return\n}\n\nvar workspace = new Blockly.Workspace();\nBlockly.Xml.domToWorkspace(xml, workspace);\nvar code = Blockly.JavaScript.workspaceToCode(workspace);\n\nconsole.log(code)  \n```\nCompiled result\n\n```js\nvar blockly; \n\nblockly = 'Hello Node.js!';\n```\n\n**Browser**\n\n[Live demo](http://mo4islona.github.io/blockly/) ([source](https://github.com/mo4islona/mo4islona.github.io/blob/master/blockly/index.js))\n\n## Internationalization\n\n```js\nimport Blockly from 'node-blockly/browser';\nimport De from 'node-blockly/lib/i18n/de';\nBlockly.setLocale(De)\n```\n\nDynamic imports also works but Blockly doesn't re-render workspace. You must [re-render it manually after locale loaded](https://github.com/mo4islona/mo4islona.github.io/blob/master/blockly/index.js#L6)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmo4islona%2Fnode-blockly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmo4islona%2Fnode-blockly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmo4islona%2Fnode-blockly/lists"}