{"id":19989589,"url":"https://github.com/wavesoft/gulp-jbb-profile","last_synced_at":"2026-05-12T18:10:47.025Z","repository":{"id":57257976,"uuid":"55349885","full_name":"wavesoft/gulp-jbb-profile","owner":"wavesoft","description":"A gulp plug-in to generate jbb profiles from specification files","archived":false,"fork":false,"pushed_at":"2016-06-07T08:57:45.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-18T10:45:46.662Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavesoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-03T14:18:29.000Z","updated_at":"2016-04-03T16:09:32.000Z","dependencies_parsed_at":"2022-08-25T21:22:45.203Z","dependency_job_id":null,"html_url":"https://github.com/wavesoft/gulp-jbb-profile","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wavesoft/gulp-jbb-profile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2Fgulp-jbb-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2Fgulp-jbb-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2Fgulp-jbb-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2Fgulp-jbb-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavesoft","download_url":"https://codeload.github.com/wavesoft/gulp-jbb-profile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesoft%2Fgulp-jbb-profile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"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","status":"online","status_checked_at":"2025-11-25T02:00:05.816Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-13T04:48:33.847Z","updated_at":"2025-11-25T18:05:07.992Z","avatar_url":"https://github.com/wavesoft.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-jbb-profile\n\n[![Version](https://img.shields.io/npm/v/gulp-jbb-profile.svg?label=version\u0026maxAge=2592000)](https://www.npmjs.com/package/gulp-jbb-profile)\n\n\u003e Compile `jbb` profiles form specification files.\n\n## Installation\n\nInstall package with NPM and add it to your development dependencies:\n\n    npm install --save-dev gulp-jbb-profile\n\n## Usage\n\n```javascript\nvar jbb_profile = require('gulp-jbb-profile');\n\ngulp.task('profile', function() {\n    return gulp\n        .src([ 'specs.yml' ])\n        .pipe(jbb_profile({\n            'name': 'my-profile'\n        }))\n        .pipe(gulp.dest('build'));\n});\n```\n\n## Options\n\n- `name`\n\n    The name prefix of the file to generate. If missing, the filename of the input file will be used. The compiler will generate an `-encode.js` and `-decode.js` file with the encoding and decoding instructions for your profile.\n\n## Specification Example\n\nThe following is a very simple specifications file that defines the properties of two objects: `Vector2` and `Vector3`:\n\n```yaml\n@uuid: 1\n@revision: 1\n\nVector2:\n    properties:\n        - x\n        - y\n\nVector3:\n    extends: Vector2\n    properties:\n        - z\n```\n\n## Specification Syntax\n\nThe syntax specifications file is a `yaml` data file that contains all the javascript objects to be supported, along with their properties. For example:\n\n```yaml\nTHREE.Vector3:\n    properties:\n        - x\n        - y\n        - z\n```\n\nThere are various other properties available, explained in the following sections.\n\n### `@xxx` - Meta properties\n\nYou can optionally specify various metadata properties for your profile:\n\n- `@uuid`: Specify the unique ID of this profile table (32-bit)\n- `@revision`: Specify the profile revision\n- `@include[.encode|.decode]`: Include the specified file (globally or only on encoding/decoding).\n- `@require[.encode|.decode]`: Require the specified node module (globally, or only on encoding/decoding).\n\nFor example:\n\n```yaml\n@uuid: 0x0100\n@revision: 1\n@include: lib/CustomFunctions.js\n@include.encode: lib/EncodeFunctions.js\n@require:\n    THREE: three\n```\n\n### `extends`/`depends` - Inheritance\n\nUsing the `extends` property you can define inheritance of properties from another object:\n\n```yaml\nTHREE.Object3D:\n    properties:\n        - position\n        - rotation\n\n# This will also inherit the properties\n# of THREE.Object3D\nTHREE.Scene:\n    extends: THREE.Object3D\n    properties:\n        - children\n\n# This will only make sure that instances of THREE.Person are \n# tested before THREE.Object3D. No properties or are inherited.\nTHREE.Person:\n    depends: THREE.Object3D\n    properties:\n        - position\n```\n\nIf you don't want to inherit any properties, but you want your object to be tested before it's super-class you can use the `depends` keyword. This way it will not inherit it's properties.\n\n### `init` - Constructor\n\nIt is important to note that jbb does not instantiate the objects in a single call, rather it separates this process in two distinct phases:\n\n 1. At first, JBB will create an instance of the object, without knowing any of it's serialized properties.\n 2. When the properties are known, an initialization function will be called.\n\nThe `init` property can be configured according to your needs. Depending on each object's particularities, one of the following options can be used:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eValue\u003c/th\u003e\n        \u003cth\u003eDescription\u003c/th\u003e\n        \u003cth\u003eWhen to use\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003edefault\u003c/td\u003e\n        \u003ctd\u003eUse the \u003ccode\u003enew\u003c/code\u003e keyword, with no arguments to create an object instance, and then define it's properties.\u003c/td\u003e\n        \u003ctd\u003eWhen the object constructor is simple. For example when it only initializes the properties with some default values.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003e[ prop, ... ]\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eUse the \u003ccode\u003eObject.create(prototype)\u003c/code\u003e method to create an empty instance, and then call it's constructor to populate it's properties. The variable names passed in the array will be passed in that order to the object constructor. \u003cem\u003eNote:\u003c/em\u003e If you are tracking more properties than the ones you use in the constructor, they will be set to the instance, after it's initialized.\u003c/td\u003e\n        \u003ctd\u003eWhen the object does more in the constructor than just assign the values to it's properties. For example, when it generates some data based on the arguments.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003e{ prop: ... }\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eUse the \u003ccode\u003enew\u003c/code\u003e keyword, with no arguments to create an object instance, and then define it's properties. The dictionary provides fine-grained control over the way each property gets assigned to the instance. The value of the key is a javascript snipped for assigning the value to the instance. Script macros are available, refer to the _Script Macros_ section below for more details.\u003c/td\u003e\n        \u003ctd\u003eWhen you are satisfied with the default, but you want a bit more fine-grained control on some properties.\u003c/td\u003e        \n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003ccode\u003efunction\u003c/code\u003e\u003c/td\u003e\n        \u003ctd\u003eUse the \u003ccode\u003eObject.create(prototype)\u003c/code\u003e method to create an empty instance, and then call a user function to initialize it's properties.\u003c/td\u003e\n        \u003ctd\u003eWhen the data needs some processing before they are assigned to the object. For example, when you need to create an image element from an image URL.\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\nThe following example illustrates the previous values:\n\n```yaml\n# This will do:\n#\n#   inst = new THREE.Vector3()\n#   inst.x = values[0]\n#   inst.y = values[1]\n#   inst.z = values[2]\n#\nTHREE.Vector3:\n    init: default\n    properties:\n        - x\n        - y\n        - z\n\n# This will do:\n#\n#   inst = new THREE.Object3D()\n#   inst.name = values[0]\n#   inst.position.copy( values[1] )\n#   inst.color.set( values[2], values[3], values[4] )\n#\nTHREE.Object3D:\n    init:\n        position: $inst.position.copy( $value )\n        color: $inst.color.set( $$red, $$green, $$blue )\n    properties:\n        - name\n        - position\n        - red\n        - green\n        - blue\n\n# This will do:\n#\n#   inst = Object.create(THREE.Vector3.prototype)\n#   THREE.Vector3.call( inst, values[0], \n#                             values[1], \n#                             values[2] )\nTHREE.Vector3:\n    init: [x,y,z]\n    properties:\n        - x\n        - y\n        - z\n\n# Demonstrating the note on second case,\n# the extra properties will be defined afterwards:\n#\n#   inst = Object.create(THREE.Vector3.prototype)\n#   THREE.Vector3.call( inst, values[0], \n#                             values[1], \n#                             values[2] )\n#   inst.more1 = values[3];\n#   inst.more2 = values[4];\n#\nTHREE.Vector3:\n    init: [x,y,z]\n    properties:\n        - x\n        - y\n        - z\n        - more1\n        - more2\n\n# This will do:\n#\n#   inst = Object.create(THREE.Vector3.prototype)\n#   user_function( inst, values )\n#\nTHREE.Vector3:\n    init: user_function\n    properties:\n        - x\n        - y\n        - z\n```\n\n### `frequent` - Frequently Encountered Flag\n\nThis flag should be set to `true` if this object is frequently encountered. Such objects are encoded in a more optimised way.\n\n_NOTE: The optimisation works only for the first 32 objects, so carefully chose your frequent objects._\n\n### `postInit` - Post-init Script\n\nThis property contains a script that will be executed right after the object is constructed in order to initialise the instance. Script macros are available, refer to the _Script Macros_ section below for more details.\n\nFor example:\n\n```yaml\nTHREE.Mesh:\n    extends: THREE.Object3D\n    postInit: |\n        $inst.updateMorphTargets();\n    properties:\n        - geometry\n        - material\n        - materialTexture\n        - materialWireframe\n```\n\n### `embed` - Embed resources\n\nThis is an array of property names, that are string and pointing to URLs. The resources pointed by the URLs will be downloaded at compile time and embedded as a binary blob in the bundle. At decoding time, a blob URL will be used in place of the actual URL.\n\nFor example:\n\n```yaml\n# This will download the file pointed by \n# the 'url' property and store it in the bundle.\nAudioFile:\n    properties:\n        - url\n        - volume\n        - pan\n    embed:\n        - url\n```\n\n## Script Macros\n\nThe following macros can be used when writing in-line javascript snippets (ex. `postInit` or `init` customisations):\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003e$inst\u003c/th\u003e\n        \u003ctd\u003eExpands to the variable that refers to the object instance.\u003c/td\u003e\n    \u003c/tr\n    \u003ctr\u003e\n        \u003cth\u003e$prop\u003c/th\u003e\n        \u003ctd\u003eExpands to the name of the current property (not available on \u003ccode\u003epostInit\u003c/code\u003e).\u003c/td\u003e\n    \u003c/tr\n    \u003ctr\u003e\n        \u003cth\u003e$value\u003c/th\u003e\n        \u003ctd\u003eExpands to the value of the current property (not available on \u003ccode\u003epostInit\u003c/code\u003e).\u003c/td\u003e\n    \u003c/tr\n    \u003ctr\u003e\n        \u003cth\u003e$values\u003c/th\u003e\n        \u003ctd\u003eExpands to the array that contains all the encoded properties in the order they were defined.\u003c/td\u003e\n    \u003c/tr\n    \u003ctr\u003e\n        \u003cth\u003e$$\u003cem\u003eproperty\u003c/em\u003e\u003c/th\u003e\n        \u003ctd\u003eExpands to the value of the object property with the given name (as received from the de-serialization function).\u003c/td\u003e\n    \u003c/tr\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesoft%2Fgulp-jbb-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavesoft%2Fgulp-jbb-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesoft%2Fgulp-jbb-profile/lists"}