{"_id":"rosetta","_rev":"19-71463d294a6eb28983c1ba305080df02","name":"rosetta","description":"A general purpose internationalization library in 298 bytes","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"rosetta","version":"0.1.0","description":"Shared variables between CSS and Javascript.","author":{"name":"Ned Burns","email":"net7runner@gmail.com"},"main":"lib/rosetta.js","bin":{"rosetta":"./bin/rosetta"},"homepage":"https://github.com/7sempra/rosetta","repository":{"type":"git","url":"https://github.com/7sempra/rosetta.git"},"bugs":{"url":"https://github.com/7sempra/rosetta/issues"},"licenses":[{"type":"MIT","url":"http://github.com/7sempra/rosetta/blob/master/LICENSE-MIT"}],"dependencies":{"classdef":"~1.0.1","nopt":"~2.1.1","glob":"~3.1.21","underscore":"~1.4.4","mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.2.0","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-watch":"~0.3.1","grunt-contrib-clean":"~0.4.0"},"keywords":["css","javascript","shared","variables","stylus","sass","less","gruntplugin"],"readme":"# Rosetta\n\nRosetta is a CSS *pre-* preprocessor that allows you to share variables between your Javascript code and a CSS preprocessor such as [Stylus](http://learnboost.github.com/stylus/), [Sass](http://sass-lang.com/), or [LESS](http://lesscss.org/).\n\nIt works like this:\n\n1. You define your shared variables in one or more `.rose` files.\n2. Rosetta compiles your `.rose` files into a Javascript module and one or more Stylus/Sass/LESS files.\n\nRosetta supports the following export formats:\n* **Javascript:** CommonJS module, RequireJS module, or flat JS file.\n* **CSS:** Stylus, Sass/Scss, or LESS syntax.\n\nRosetta's export system is easily extensible; it is straightforward to add new export formats as desired.\n\n## Example\n\nImagine you want to want to create a shared variable:\n\n    $thumbnailSize = 250px\n\nRosetta allows you to use this variable in both your Javascript:\n```js\nvar rosetta = require('./rosetta');\nconsole.log('Thumbnail size is:', rosetta.thumbnailSize.val);\n```\n\n...and your CSS (in this case, a Stylus file):\n```css\n@import rosetta\n.thumb {\n  width: $thumbnailSize\n  height: $thumbnailSize\n}\n```\n\n## How to install\n\nYou can use Rosetta via the command-line, as a [Grunt](http://gruntjs.com) plugin, or as a Javascript library.\n\nTo install for use on the command-line:\n```\n$ sudo npm install -g rosetta\n```\n\nTo install for Grunt or as a JS library:\n```\n$ npm install rosetta\n```\n\nSee [How to run Rosetta](#howToRun) for instructions on how to invoke the compiler.\n\n## File format\n\nRosetta uses the same variable declaration syntax as Stylus. It looks like this:\n```\n$myVar = 55px\n```\nSemicolons are optional.\n\nYou can use a variety of data types:\n```\n$number = 45px\n$color = #00FF00\n$rgb = rgba(255, 13, 17, 0.3)\n$url = url('/penguins.png')\n$string = 'hello, world'\n$css = top left, center center\n```\n\nVariables can reference other variables and be combined using arithmetic expressions:\n```\n$foo = 35px\n$bar = $foo + 5 // bar is 40px\n$baz = foo * (bar - 45)\n```\n\nFinally, you can organize your variables into namespaces:\n```\ncolors:\n  $red = #990000\n  $selection = #1122CC\n  $highlight = #1199AA\n\n  prompts:\n    $text = #222\n    $warn = #F0F\n    $error = #F00\n\n// You can 'add' to a namespace after the fact like this.\n// This can even occur in a separate .rose file\ncolors.somethingElse:\n  $foo = colors.prompts.$error  // fully-qualified references!\n```\n\nRosetta can either dump each namespace to its own CSS file or concat them into a single large file.\n\n## Accessing Rosetta variables\n\n### Javascript\nRosetta creates a JS object whose structure reflects your namespace structure. Given a Rosetta file like this:\n```\n$numShapes = 5\nanimationDurations:\n  $dialogAppear = 400ms\n  $dialogDismiss = 200ms\n```\n...the vars can be accessed like this:\n```js\n// in this example, we're using the CommonJS output format\nvar rosetta = require('./rosetta');\n...\nrosetta.numShapes.val;    // 5\nrosetta.animationDurations.dialogAppear.val;    // 400\nrosetta.animationDurations.dialogAppear.unit;   // 'ms'\n```\n\nEvery Rosetta variable has the following properties:\n* `val` - The 'value' part of the variable. For numbers this means just the number part (e.g. `400` from `400px`). For colors, it will be a 24-bit number (e.g. 0xAC2B39). For URLs, it will be the URL itself. Strings and raw CSS are both just strings.\n* `type` - One of `number`, `color`, `string`, `url`, or `css`.\n\nSome datatypes have additional properties:\n\n#### number\n* `unit` - The unit associated with the number, e.g. `px` or `%`. `null` if no unit specified.\n\n#### color\n* `r` - Red (0-255)\n* `g` - Green (0-255)\n* `b` - Blue (0-255)\n* `a` - Alpha (0-1)\n\n### CSS\nAll your variables will be exported to the format you specified, e.g.\n```\n@highlight: #2211CC // Sass format\n```\n\nHowever, all variables declared inside of a namespace will also be exported with a fully-qualified name:\n```\n// defined in colors.dialog.$highlight\n@highlight: #2211CC\n@colors-dialog-highlight: #2211CC\n```\n\nThis allows you to access the variable even if its shortname gets trampled by something else.\n\n## <a name=\"howToRun\"></a>How to run Rosetta\n\n### Command-line\n\n```\nUsage: rosetta {OPTIONS} [files]\n\nExample:\nrosetta --jsout \"lib/css.js\" --cssout \"stylus/{{ns}}.styl\" rosetta/**/*.rose\n\nOptions:\n\n  --jsOut          Write the JS module to this file.\n\n  --cssOut         Write the CSS to this file. If the path contains the string\n                   '{{ns}}', then a file will be created for every namespace in\n                   your .rose files, replacing the {{ns}} with the name of each\n                   of your namspaces.\n\n  --jsFormat       The desired output format for the JS module. Supports\n                   'commonjs', 'requirejs', and 'flat'. Default: 'commonjs'.\n\n  --cssFormat      Desired output format for the CSS file(s). Should be one of\n                   'stylus', 'sass', 'scss', or 'less'. Default: 'stylus'.\n\n  --jsTemplate     A custom template that defines how the Javascript should be\n                   formatted. This should be in the format of an Underscore.js\n                   template, and must specify slots for variables named\n                   'preamble' and 'blob'. For example:\n                   $'<%= preamble %>\\n var x = <%= blob %>;'\n                   (the leading $ is required if you want bash to understand \\n)\n\n  --cssTemplate    A custom template that defines how a single CSS variable\n                   should be formatted. This should be a string in the form of\n                   an Underscore.js template, and must specify slots for\n                   variables named 'k' (the name of the variable) and 'v' (the\n                   value of the variable). For example:\n                   '$<%= k %>: <%= v %>;''\n\n  --version, -v    Print the current version to stdout.\n\n  --help, -h       Show this message.\n\n[files] can be a list of any number of files. Glob syntax is supported,\ne.g. 'rosetta/**/*.rose' will resolve to all files that are contained in the\n'rosetta' directory (or any of its subdirectories) and that end with '.rose'.\n```\n\nNote: Normally, rosetta will dump your CSS to a single file. However, if your `cssOut` path contains the string `{{ns}}`, then it will instead dump each namespace to its own file, replacing `{{ns}}` with the namespace's name. This allows you to `@include` these files individually, which can be nice if you have a lot of them, e.g.\n\n```css\n@import colors\n@import colors/prompts\n@import animation/prompts\n```\n\n### As a Grunt plugin\n\nAll options are the same as those for the command-line. At the very least, you should specify paths for `jsOut` and `cssOut`.\n\nFor example:\n```js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    ...\n    rosetta: {\n      default: {\n        src: ['rosetta/**/*.rose'],\n        options: {\n          jsFormat: 'requirejs',\n          cssFormat: 'less',\n          jsOut: 'lib/rosetta.js',\n          cssOut: 'less/rosetta/{{ns}}.less',\n        }\n      }\n    }\n  });\n  ...\n  grunt.loadNpmTasks('rosetta');\n};\n```\n\n### Javascript API\n\nExample:\n```js\nrosetta.compile(['foo.rose', 'bar.rose'], {\n  jsFormat: 'flat',\n  cssFormat: 'less',\n  jsOut: 'lib/rosetta.js',\n  cssOut: 'less/rosetta.less'\n}, function(err, outfiles) {\n  if (err) throw err;\n  rosetta.writeFiles(outfiles, function(err) {\n    if (err) throw err;\n    console.log('Done!');\n  }\n});\n```\n\nRosetta exposes two functions: `compile` and `writeFiles`:\n\n```js\nrosetta.compile(sources, options, callback(err, outfiles));\n```\n...where `sources` is an array of paths and `options` is an hashmap of options (see below). `outfiles` will be an array of `{path, text}` objects, which you can pass directly to `rosetta.writeFile()`.\n\n`options` are the same as those for the command-line API.\n\n```js\nrosetta.writeFiles([{path, text}], callback(err));\n```\n`writeFiles` will actually write all of the compiled files to disk, creating directories as necessary.\n\n## License\n\nLicensed under the MIT license.\nhttp://github.com/7sempra/rosetta/blob/master/LICENSE-MIT","readmeFilename":"README.md","_id":"rosetta@0.1.0","dist":{"shasum":"87fb4223a933476889b9142a92ac90d3e4febe5d","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-0.1.0.tgz","integrity":"sha512-bDY0WH2yy5KhuvkUQi2AzOjI2FScEUJcwk3By4UhRXbLw4R0RZOAReyKDkkDOmSOCC90z6jMx+LCqK9Hx+hohQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHw30ViFdu4WlgcXIJVyMC0CZ0stzksspDJwKwiu3Fs1AiEAxgfsYH2n3Ia+ChMri4iBmxb4rJrxvut6C8MfDEQ+Rxg="}]},"_from":"rosetta","_npmVersion":"1.2.13","_npmUser":{"name":"7sempra","email":"net7runner@gmail.com"},"maintainers":[{"name":"7sempra","email":"net7runner@gmail.com"}],"directories":{}},"0.1.1":{"name":"rosetta","version":"0.1.1","description":"Shared variables between CSS and Javascript.","author":{"name":"Ned Burns","email":"net7runner@gmail.com"},"main":"lib/rosetta.js","bin":{"rosetta":"./bin/rosetta"},"homepage":"https://github.com/7sempra/rosetta","repository":{"type":"git","url":"https://github.com/7sempra/rosetta.git"},"bugs":{"url":"https://github.com/7sempra/rosetta/issues"},"licenses":[{"type":"MIT","url":"http://github.com/7sempra/rosetta/blob/master/LICENSE-MIT"}],"dependencies":{"classdef":"~1.0.1","nopt":"~2.1.1","glob":"~3.1.21","underscore":"~1.4.4","mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.2.0","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-watch":"~0.3.1","grunt-contrib-clean":"~0.4.0"},"keywords":["css","javascript","shared","variables","stylus","sass","less","gruntplugin"],"readme":"# Rosetta\n\nRosetta is a CSS *pre-* preprocessor that allows you to share variables between your Javascript code and a CSS preprocessor such as [Stylus](http://learnboost.github.com/stylus/), [Sass](http://sass-lang.com/), or [LESS](http://lesscss.org/).\n\nIt works like this:\n\n1. You define your shared variables in one or more `.rose` files.\n2. Rosetta compiles your `.rose` files into a Javascript module and one or more Stylus/Sass/LESS files.\n\nRosetta supports the following export formats:\n* **Javascript:** CommonJS module, RequireJS module, or flat JS file.\n* **CSS:** Stylus, Sass/Scss, or LESS syntax.\n\nRosetta's export system is easily extensible; it is straightforward to add new export formats as desired.\n\n## Example\n\nImagine you want to want to create a shared variable:\n\n    $thumbnailSize = 250px\n\nRosetta allows you to use this variable in both your Javascript:\n```js\nvar rosetta = require('./rosetta');\nconsole.log('Thumbnail size is:', rosetta.thumbnailSize.val);\n```\n\n...and your CSS (in this case, a Stylus file):\n```css\n@import rosetta\n.thumb {\n  width: $thumbnailSize\n  height: $thumbnailSize\n}\n```\n\n## How to install\n\nYou can use Rosetta via the command-line, as a [Grunt](http://gruntjs.com) plugin, or as a Javascript library.\n\nTo install for use on the command-line:\n```\n$ sudo npm install -g rosetta\n```\n\nTo install for Grunt or as a JS library:\n```\n$ npm install rosetta\n```\n\nSee [How to run Rosetta](#howToRun) for instructions on how to invoke the compiler.\n\n## File format\n\nRosetta uses the same variable declaration syntax as Stylus. It looks like this:\n```\n$myVar = 55px\n```\nSemicolons are optional.\n\nYou can use a variety of data types:\n```\n$number = 45px\n$color = #00FF00\n$rgb = rgba(255, 13, 17, 0.3)\n$url = url('/penguins.png')\n$string = 'hello, world'\n$css = top left, center center\n```\n\nVariables can reference other variables and be combined using arithmetic expressions:\n```\n$foo = 35px\n$bar = $foo + 5 // bar is 40px\n$baz = foo * (bar - 45)\n```\n\nFinally, you can organize your variables into namespaces:\n```\ncolors:\n  $red = #990000\n  $selection = #1122CC\n  $highlight = #1199AA\n\n  prompts:\n    $text = #222\n    $warn = #F0F\n    $error = #F00\n\n// You can 'add' to a namespace after the fact like this.\n// This can even occur in a separate .rose file\ncolors.somethingElse:\n  $foo = colors.prompts.$error  // fully-qualified references!\n```\n\nRosetta can either dump each namespace to its own CSS file or concat them into a single large file.\n\n## Accessing Rosetta variables\n\n### Javascript\nRosetta creates a JS object whose structure reflects your namespace structure. Given a Rosetta file like this:\n```\n$numShapes = 5\nanimationDurations:\n  $dialogAppear = 400ms\n  $dialogDismiss = 200ms\n```\n...the vars can be accessed like this:\n```js\n// in this example, we're using the CommonJS output format\nvar rosetta = require('./rosetta');\n...\nrosetta.numShapes.val;    // 5\nrosetta.animationDurations.dialogAppear.val;    // 400\nrosetta.animationDurations.dialogAppear.unit;   // 'ms'\n```\n\nEvery Rosetta variable has the following properties:\n* `val` - The 'value' part of the variable. For numbers this means just the number part (e.g. `400` from `400px`). For colors, it will be a 24-bit number (e.g. 0xAC2B39). For URLs, it will be the URL itself. Strings and raw CSS are both just strings.\n* `type` - One of `number`, `color`, `string`, `url`, or `css`.\n\nSome datatypes have additional properties:\n\n#### number\n* `unit` - The unit associated with the number, e.g. `px` or `%`. `null` if no unit specified.\n\n#### color\n* `r` - Red (0-255)\n* `g` - Green (0-255)\n* `b` - Blue (0-255)\n* `a` - Alpha (0-1)\n\n### CSS\nAll your variables will be exported to the format you specified, e.g.\n```\n@highlight: #2211CC // Sass format\n```\n\nHowever, all variables declared inside of a namespace will also be exported with a fully-qualified name:\n```\n// defined in colors.dialog.$highlight\n@highlight: #2211CC\n@colors-dialog-highlight: #2211CC\n```\n\nThis allows you to access the variable even if its shortname gets trampled by something else.\n\n## <a name=\"howToRun\"></a>How to run Rosetta\n\n### Command-line\n\n```\nUsage: rosetta {OPTIONS} [files]\n\nExample:\nrosetta --jsout \"lib/css.js\" --cssout \"stylus/{{ns}}.styl\" rosetta/**/*.rose\n\nOptions:\n\n  --jsOut          Write the JS module to this file.\n\n  --cssOut         Write the CSS to this file. If the path contains the string\n                   '{{ns}}', then a file will be created for every namespace in\n                   your .rose files, replacing the {{ns}} with the name of each\n                   of your namspaces.\n\n  --jsFormat       The desired output format for the JS module. Supports\n                   'commonjs', 'requirejs', and 'flat'. Default: 'commonjs'.\n\n  --cssFormat      Desired output format for the CSS file(s). Should be one of\n                   'stylus', 'sass', 'scss', or 'less'. Default: 'stylus'.\n\n  --jsTemplate     A custom template that defines how the Javascript should be\n                   formatted. This should be in the format of an Underscore.js\n                   template, and must specify slots for variables named\n                   'preamble' and 'blob'. For example:\n                   $'<%= preamble %>\\n var x = <%= blob %>;'\n                   (the leading $ is required if you want bash to understand \\n)\n\n  --cssTemplate    A custom template that defines how a single CSS variable\n                   should be formatted. This should be a string in the form of\n                   an Underscore.js template, and must specify slots for\n                   variables named 'k' (the name of the variable) and 'v' (the\n                   value of the variable). For example:\n                   '$<%= k %>: <%= v %>;'\n\n  --version, -v    Print the current version to stdout.\n\n  --help, -h       Show this message.\n\n[files] can be a list of any number of files. Glob syntax is supported,\ne.g. 'rosetta/**/*.rose' will resolve to all files that are contained in the\n'rosetta' directory (or any of its subdirectories) and that end with '.rose'.\n```\n\nNote: Normally, rosetta will dump your CSS to a single file. However, if your `cssOut` path contains the string `{{ns}}`, then it will instead dump each namespace to its own file, replacing `{{ns}}` with the namespace's name. This allows you to `@include` these files individually, which can be nice if you have a lot of them, e.g.\n\n```css\n@import colors\n@import colors/prompts\n@import animation/prompts\n```\n\n### As a Grunt plugin\n\nAll options are the same as those for the command-line. At the very least, you should specify paths for `jsOut` and `cssOut`.\n\nFor example:\n```js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    ...\n    rosetta: {\n      default: {\n        src: ['rosetta/**/*.rose'],\n        options: {\n          jsFormat: 'requirejs',\n          cssFormat: 'less',\n          jsOut: 'lib/rosetta.js',\n          cssOut: 'less/rosetta/{{ns}}.less',\n        }\n      }\n    }\n  });\n  ...\n  grunt.loadNpmTasks('rosetta');\n};\n```\n\n### Javascript API\n\nExample:\n```js\nrosetta.compile(['foo.rose', 'bar.rose'], {\n  jsFormat: 'flat',\n  cssFormat: 'less',\n  jsOut: 'lib/rosetta.js',\n  cssOut: 'less/rosetta.less'\n}, function(err, outfiles) {\n  if (err) throw err;\n  rosetta.writeFiles(outfiles, function(err) {\n    if (err) throw err;\n    console.log('Done!');\n  }\n});\n```\n\nRosetta exposes two functions: `compile` and `writeFiles`:\n\n```js\nrosetta.compile(sources, options, callback(err, outfiles));\n```\n...where `sources` is an array of paths and `options` is an hashmap of options (see below). `outfiles` will be an array of `{path, text}` objects, which you can pass directly to `rosetta.writeFile()`.\n\n`options` are the same as those for the command-line API.\n\n```js\nrosetta.writeFiles([{path, text}], callback(err));\n```\n`writeFiles` will actually write all of the compiled files to disk, creating directories as necessary.\n\n## License\n\nLicensed under the MIT license.\nhttp://github.com/7sempra/rosetta/blob/master/LICENSE-MIT","readmeFilename":"README.md","_id":"rosetta@0.1.1","dist":{"shasum":"5497eb2abe2ffaf812df9ad3051889efe8e2a0bb","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-0.1.1.tgz","integrity":"sha512-96gIYrJyhtaGzEa/FmLU7gNFknwQ1yfNxbHt/va/bh2+x7tpYi5Q30dSIKxm6yoiEisazIPZ899D7PzZbXhWkw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVJlwp3ukMhAxt+JtBC1/fSWW3xzPk9x47vzQSnnMqjAIhAIZvwm4FBeEjVUaHjzfd4cx9STHPtnUAlGI7LVyG5TF8"}]},"_from":".","_npmVersion":"1.2.13","_npmUser":{"name":"7sempra","email":"net7runner@gmail.com"},"maintainers":[{"name":"7sempra","email":"net7runner@gmail.com"}],"directories":{}},"0.2.0":{"name":"rosetta","version":"0.2.0","description":"Shared variables between CSS and Javascript.","author":{"name":"Ned Burns","email":"net7runner@gmail.com"},"main":"lib/rosetta.js","bin":{"rosetta":"./bin/rosetta"},"homepage":"https://github.com/7sempra/rosetta","repository":{"type":"git","url":"https://github.com/7sempra/rosetta.git"},"bugs":{"url":"https://github.com/7sempra/rosetta/issues"},"licenses":[{"type":"MIT","url":"http://github.com/7sempra/rosetta/blob/master/LICENSE-MIT"}],"dependencies":{"classdef":"~1.0.1","nopt":"~2.1.1","glob":"~3.1.21","underscore":"~1.4.4","mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.2.0","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-watch":"~0.3.1","grunt-contrib-clean":"~0.4.0"},"keywords":["css","javascript","shared","variables","stylus","sass","less","gruntplugin"],"readme":"# Rosetta\n\nRosetta is a CSS *pre-* preprocessor that allows you to share variables between your Javascript code and a CSS preprocessor such as [Stylus](http://learnboost.github.com/stylus/), [Sass](http://sass-lang.com/), or [LESS](http://lesscss.org/).\n\nIt works like this:\n\n1. You define your shared variables in one or more `.rose` files.\n2. Rosetta compiles your `.rose` files into a Javascript module and one or more Stylus/Sass/LESS files.\n\nRosetta supports the following export formats:\n* **Javascript:** CommonJS module, RequireJS module, or flat JS file.\n* **CSS:** Stylus, Sass/Scss, or LESS syntax.\n\nRosetta's export system is easily extensible; it is straightforward to add new export formats as desired.\n\n## Example\n\nImagine you want to want to create a shared variable:\n\n    $thumbnailSize = 250px\n\nRosetta allows you to use this variable in both your Javascript:\n```js\nvar rosetta = require('./rosetta');\nconsole.log('Thumbnail size is:', rosetta.thumbnailSize.val);\n```\n\n...and your CSS (in this case, a Stylus file):\n```css\n@import rosetta\n.thumb {\n  width: $thumbnailSize\n  height: $thumbnailSize\n}\n```\n\n## How to install\n\nYou can use Rosetta via the command-line, as a [Grunt](http://gruntjs.com) plugin, or as a Javascript library.\n\nTo install for use on the command-line:\n```\n$ sudo npm install -g rosetta\n```\n\nTo install for Grunt or as a JS library:\n```\n$ npm install rosetta\n```\n\nSee [How to run Rosetta](#howToRun) for instructions on how to invoke the compiler.\n\n## File format\n\nRosetta uses the same variable declaration syntax as Stylus. It looks like this:\n```\n$myVar = 55px\n```\nSemicolons are optional.\n\nYou can use a variety of data types:\n```\n$number = 45px\n$color = #00FF00\n$rgb = rgba(255, 13, 17, 0.3)\n$url = url('/penguins.png')\n$string = 'hello, world'\n$css = top left, center center\n```\n\nVariables can reference other variables and be combined using arithmetic expressions:\n```\n$foo = 35px\n$bar = $foo + 5 // bar is 40px\n$baz = foo * (bar - 45)\n```\n\nFinally, you can organize your variables into namespaces:\n```\ncolors:\n  $red = #990000\n  $selection = #1122CC\n  $highlight = #1199AA\n\n  prompts:\n    $text = #222\n    $warn = #F0F\n    $error = #F00\n\n// You can 'add' to a namespace after the fact like this.\n// This can even occur in a separate .rose file\ncolors.somethingElse:\n  $foo = colors.prompts.$error  // fully-qualified references!\n```\n\nRosetta can either dump each namespace to its own CSS file or concat them into a single large file.\n\n## Accessing Rosetta variables\n\n### Javascript\nRosetta creates a JS object whose structure reflects your namespace structure. Given a Rosetta file like this:\n```\n$numShapes = 5\nanimationDurations:\n  $dialogAppear = 400ms\n  $dialogDismiss = 200ms\n```\n...the vars can be accessed like this:\n```js\n// in this example, we're using the CommonJS output format\nvar rosetta = require('./rosetta');\n...\nrosetta.numShapes.val;    // 5\nrosetta.animationDurations.dialogAppear.val;    // 400\nrosetta.animationDurations.dialogAppear.unit;   // 'ms'\n```\n\nEvery Rosetta variable has the following properties:\n* `val` - The 'value' part of the variable. For numbers this means just the number part (e.g. `400` from `400px`). For colors, it will be a 24-bit number (e.g. 0xAC2B39). For URLs, it will be the URL itself. Strings and raw CSS are both just strings.\n* `type` - One of `number`, `color`, `string`, `url`, or `css`.\n\nSome datatypes have additional properties:\n\n#### number\n* `unit` - The unit associated with the number, e.g. `px` or `%`. `null` if no unit specified.\n\n#### color\n* `r` - Red (0-255)\n* `g` - Green (0-255)\n* `b` - Blue (0-255)\n* `a` - Alpha (0-1)\n\n### CSS\nAll your variables will be exported to the format you specified, e.g.\n```\n@highlight: #2211CC // Sass format\n```\n\nHowever, all variables declared inside of a namespace will also be exported with a fully-qualified name:\n```\n// defined in colors.dialog.$highlight\n@highlight: #2211CC\n@colors-dialog-highlight: #2211CC\n```\n\nThis allows you to access the variable even if its shortname gets trampled by something else.\n\n## <a name=\"howToRun\"></a>How to run Rosetta\n\n### Command-line\n\n```\nUsage: rosetta {OPTIONS} [files]\n\nExample:\nrosetta --jsout \"lib/css.js\" --cssout \"stylus/{{ns}}.styl\" rosetta/**/*.rose\n\nOptions:\n\n  --jsOut          Write the JS module to this file.\n\n  --cssOut         Write the CSS to this file. If the path contains the string\n                   '{{ns}}', then a file will be created for every namespace in\n                   your .rose files, replacing the {{ns}} with the name of each\n                   of your namspaces.\n\n  --jsFormat       The desired output format for the JS module. Supports\n                   'commonjs', 'requirejs', and 'flat'. Default: 'commonjs'.\n\n  --cssFormat      Desired output format for the CSS file(s). Should be one of\n                   'stylus', 'sass', 'scss', or 'less'. Default: 'stylus'.\n\n  --jsTemplate     A custom template that defines how the Javascript should be\n                   formatted. This should be in the format of an Underscore.js\n                   template, and must specify slots for variables named\n                   'preamble' and 'blob'. For example:\n                   $'<%= preamble %>\\n var x = <%= blob %>;'\n                   (the leading $ is required if you want bash to understand \\n)\n\n  --cssTemplate    A custom template that defines how a single CSS variable\n                   should be formatted. This should be a string in the form of\n                   an Underscore.js template, and must specify slots for\n                   variables named 'k' (the name of the variable) and 'v' (the\n                   value of the variable). For example:\n                   '$<%= k %>: <%= v %>;'\n\n  --version, -v    Print the current version to stdout.\n\n  --help, -h       Show this message.\n\n[files] can be a list of any number of files. Glob syntax is supported,\ne.g. 'rosetta/**/*.rose' will resolve to all files that are contained in the\n'rosetta' directory (or any of its subdirectories) and that end with '.rose'.\n```\n\nNote: Normally, rosetta will dump your CSS to a single file. However, if your `cssOut` path contains the string `{{ns}}`, then it will instead dump each namespace to its own file, replacing `{{ns}}` with the namespace's name. This allows you to `@include` these files individually, which can be nice if you have a lot of them, e.g.\n\n```css\n@import colors\n@import colors/prompts\n@import animation/prompts\n```\n\n### As a Grunt plugin\n\nAll options are the same as those for the command-line. At the very least, you should specify paths for `jsOut` and `cssOut`.\n\nFor example:\n```js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    ...\n    rosetta: {\n      default: {\n        src: ['rosetta/**/*.rose'],\n        options: {\n          jsFormat: 'requirejs',\n          cssFormat: 'less',\n          jsOut: 'lib/rosetta.js',\n          cssOut: 'less/rosetta/{{ns}}.less',\n        }\n      }\n    }\n  });\n  ...\n  grunt.loadNpmTasks('rosetta');\n};\n```\n\n### Javascript API\n\nExample:\n```js\nrosetta.compile(['foo.rose', 'bar.rose'], {\n  jsFormat: 'flat',\n  cssFormat: 'less',\n  jsOut: 'lib/rosetta.js',\n  cssOut: 'less/rosetta.less'\n}, function(err, outfiles) {\n  if (err) {\n    console.error(rosetta.formatError(err));\n  } else {\n    rosetta.writeFiles(outfiles, function(err) {\n      if (err) throw err;\n      console.log('Done!');\n    }\n  }\n});\n```\n\nRosetta exposes two functions: `compile` and `writeFiles`:\n\n```js\nrosetta.compile(sources, options, callback(err, outfiles));\n```\n...where `sources` is an array of paths and `options` is an hashmap of options (see below). `outfiles` will be an array of `{path, text}` objects, which you can pass directly to `rosetta.writeFile()`.\n\n`options` are the same as those for the command-line API.\n\n```js\nrosetta.writeFiles([{path, text}], callback(err));\n```\n`writeFiles` will actually write all of the compiled files to disk, creating directories as necessary.\n\n```js\nrosetta.formatError(e)\n```\nConverts a Rosetta error object into human-readable error string, including a snipper of the code that generated the error. Most useful when printing errors from `rosetta.compile`.\n\n## License\n\nLicensed under the MIT license.\nhttp://github.com/7sempra/rosetta/blob/master/LICENSE-MIT","readmeFilename":"README.md","_id":"rosetta@0.2.0","dist":{"shasum":"cc17884d6b2e107c8c50c7cf3d12177b9f30e4d5","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-0.2.0.tgz","integrity":"sha512-S1Ay6e6LdnlxKG3HMnkRxDJ5DiBbiDms2AUW4bCSsmvUbc+tePp/tP+y3zMY7MfDyPxVmPQXcRJTd6SrUG5sPA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/qajeCBNP55UkQ0g+hqc43FpIKOtNYR0fS7gA7wcPHAiEAri0bXseeh7gui7g7bssNgeT8YXQV6GlGsX4s9uddHfw="}]},"_from":".","_npmVersion":"1.2.13","_npmUser":{"name":"7sempra","email":"net7runner@gmail.com"},"maintainers":[{"name":"7sempra","email":"net7runner@gmail.com"}],"directories":{}},"0.3.0":{"name":"rosetta","version":"0.3.0","description":"Shared variables between CSS and Javascript.","author":{"name":"Ned Burns","email":"net7runner@gmail.com"},"main":"lib/rosetta.js","bin":{"rosetta":"./bin/rosetta"},"homepage":"https://github.com/7sempra/rosetta","repository":{"type":"git","url":"https://github.com/7sempra/rosetta.git"},"bugs":{"url":"https://github.com/7sempra/rosetta/issues"},"licenses":[{"type":"MIT","url":"http://github.com/7sempra/rosetta/blob/master/LICENSE-MIT"}],"dependencies":{"classdef":"~1.0.1","nopt":"~2.1.1","glob":"~3.1.21","underscore":"~1.4.4","mkdirp":"~0.3.5"},"devDependencies":{"grunt":"~0.4.0","grunt-contrib-jshint":"~0.2.0","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-watch":"~0.3.1","grunt-contrib-clean":"~0.4.0"},"keywords":["css","javascript","shared","variables","stylus","sass","less","gruntplugin"],"readme":"# Rosetta\n\n**The JS API has changed to a synchronous model in v0.3; see \"Javascript API\", below.**\n\nRosetta is a CSS *pre-* preprocessor that allows you to share variables between your Javascript code and a CSS preprocessor such as [Stylus](http://learnboost.github.com/stylus/), [Sass](http://sass-lang.com/), or [LESS](http://lesscss.org/).\n\nIt works like this:\n\n1. You define your shared variables in one or more `.rose` files.\n2. Rosetta compiles your `.rose` files into a Javascript module and one or more Stylus/Sass/LESS files.\n\nRosetta supports the following export formats:\n* **Javascript:** CommonJS module, RequireJS module, or flat JS file.\n* **CSS:** Stylus, Sass/Scss, or LESS syntax.\n\nYou can also add your own export formats; see the command-line documentation for more information.\n\n## Example\n\nImagine you want to want to create a shared variable:\n\n    $thumbnailSize = 250px\n\nRosetta allows you to use this variable in both your Javascript:\n```js\nvar rosetta = require('./rosetta');\nconsole.log('Thumbnail size is:', rosetta.thumbnailSize.val);\n```\n\n...and your CSS (in this case, a Stylus file):\n```css\n@import rosetta\n.thumb {\n  width: $thumbnailSize\n  height: $thumbnailSize\n}\n```\n\n## How to install\n\nYou can use Rosetta via the command-line, as a [Grunt](http://gruntjs.com) plugin, or as a Javascript library.\n\nTo install for use on the command-line:\n```\n$ sudo npm install -g rosetta\n```\n\nTo install for Grunt or as a JS library:\n```\n$ npm install rosetta\n```\n\nSee [How to run Rosetta](#howToRun) for instructions on how to invoke the compiler.\n\n## File format\n\nRosetta uses the same variable declaration syntax as Stylus. It looks like this:\n```\n$myVar = 55px\n```\nSemicolons are optional.\n\nYou can use a variety of data types:\n```\n$number = 45px\n$color = #00FF00\n$rgb = rgba(255, 13, 17, 0.3)\n$url = url('/penguins.png')\n$string = 'hello, world'\n$css = top left, center center\n```\n\nVariables can reference other variables and be combined using arithmetic expressions:\n```\n$foo = 35px\n$bar = $foo + 5 // bar is 40px\n$baz = foo * (bar - 45)\n```\n\nFinally, you can organize your variables into namespaces:\n```\ncolors:\n  $red = #990000\n  $selection = #1122CC\n  $highlight = #1199AA\n\n  prompts:\n    $text = #222\n    $warn = #F0F\n    $error = #F00\n\n// You can 'add' to a namespace after the fact like this.\n// This can even occur in a separate .rose file\ncolors.somethingElse:\n  $foo = colors.prompts.$error  // fully-qualified references!\n```\n\nRosetta can either dump each namespace to its own CSS file or concat them into a single large file.\n\n## Accessing Rosetta variables\n\n### Javascript\nRosetta creates a JS object whose structure reflects your namespace structure. Given a Rosetta file like this:\n```\n$numShapes = 5\nanimationDurations:\n  $dialogAppear = 400ms\n  $dialogDismiss = 200ms\n```\n...the vars can be accessed like this:\n```js\n// in this example, we're using the CommonJS output format\nvar rosetta = require('./rosetta');\n...\nrosetta.numShapes.val;    // 5\nrosetta.animationDurations.dialogAppear.val;    // 400\nrosetta.animationDurations.dialogAppear.unit;   // 'ms'\n```\n\nEvery Rosetta variable has the following properties:\n* `val` - The 'value' part of the variable. For numbers this means just the number part (e.g. `400` from `400px`). For colors, it will be a 24-bit number (e.g. 0xAC2B39). For URLs, it will be the URL itself. Strings and raw CSS are both just strings.\n* `type` - One of `number`, `color`, `string`, `url`, or `css`.\n\nSome datatypes have additional properties:\n\n#### number\n* `unit` - The unit associated with the number, e.g. `px` or `%`. `null` if no unit specified.\n\n#### color\n* `r` - Red (0-255)\n* `g` - Green (0-255)\n* `b` - Blue (0-255)\n* `a` - Alpha (0-1)\n\n### CSS\nAll your variables will be exported to the format you specified, e.g.\n```\n@highlight: #2211CC // Sass format\n```\n\nIn addition, all variables declared inside of a namespace will also be exported with a fully-qualified name:\n\n```\ncolors.dialog:\n  $highlight = #2211CC\n```\n...becomes...\n```\n@highlight: #2211CC\n@colors-dialog-highlight: #2211CC\n```\n\nThis allows you to access the variable even if its shortname gets trampled by something else.\n\n## <a name=\"howToRun\"></a>How to run Rosetta\n\n### Command-line\n\n```\nUsage: rosetta {OPTIONS} [files]\n\nExample:\nrosetta --jsout \"lib/css.js\" --cssout \"stylus/{{ns}}.styl\" rosetta/**/*.rose\n\nOptions:\n\n  --jsOut          Write the JS module to this file.\n\n  --cssOut         Write the CSS to this file. If the path contains the string\n                   '{{ns}}', then a file will be created for every namespace in\n                   your .rose files, replacing the {{ns}} with the name of each\n                   of your namspaces.\n\n  --jsFormat       The desired output format for the JS module. Supports\n                   'commonjs', 'requirejs', and 'flat'. Default: 'commonjs'.\n\n  --cssFormat      Desired output format for the CSS file(s). Should be one of\n                   'stylus', 'sass', 'scss', or 'less'. Default: 'stylus'.\n\n  --jsTemplate     A custom template that defines how the Javascript should be\n                   formatted. This should be in the format of an Underscore.js\n                   template, and must specify slots for variables named\n                   'preamble' and 'blob'. For example:\n                   $'<%= preamble %>\\n var x = <%= blob %>;'\n                   (the leading $ is required if you want bash to understand \\n)\n\n  --cssTemplate    A custom template that defines how a single CSS variable\n                   should be formatted. This should be a string in the form of\n                   an Underscore.js template, and must specify slots for\n                   variables named 'k' (the name of the variable) and 'v' (the\n                   value of the variable). For example:\n                   '$<%= k %>: <%= v %>;'\n\n  --version, -v    Print the current version to stdout.\n\n  --help, -h       Show this message.\n\n[files] can be a list of any number of files. Glob syntax is supported,\ne.g. 'rosetta/**/*.rose' will resolve to all files that are contained in the\n'rosetta' directory (or any of its subdirectories) and that end with '.rose'.\n```\n\nNote: Normally, rosetta will dump your CSS to a single file. However, if your `cssOut` path contains the string `{{ns}}`, then it will instead dump each namespace to its own file, replacing `{{ns}}` with the namespace's name. This allows you to `@include` these files individually, which can be nice if you have a lot of them, e.g.\n\n```css\n@import colors\n@import colors/prompts\n@import animation/prompts\n```\n\n### As a Grunt plugin\n\nAll options are the same as those for the command-line. At the very least, you should specify paths for `jsOut` and `cssOut`.\n\nFor example:\n```js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    ...\n    rosetta: {\n      default: {\n        src: ['rosetta/**/*.rose'],\n        options: {\n          jsFormat: 'requirejs',\n          cssFormat: 'less',\n          jsOut: 'lib/rosetta.js',\n          cssOut: 'less/rosetta/{{ns}}.less',\n        }\n      }\n    }\n  });\n  ...\n  grunt.loadNpmTasks('rosetta');\n};\n```\n\n### Javascript API\n\nExample:\n```js\ntry {\n  var outfiles = rosetta.compile(['foo.rose', 'bar.rose'], {\n    jsFormat: 'flat',\n    cssFormat: 'less',\n    jsOut: 'lib/rosetta.js',\n    cssOut: 'less/rosetta.less'\n  });\n  rosetta.writeFiles(outfiles);\n} catch (e) {\n  if (e instanceof rosetta.RosettaError) {\n    console.error(rosetta.formatError(e));\n  } else {\n    throw e;\n  }\n}\n```\n\nRosetta exposes three functions:\n\n```js\nrosetta.compile(sources, options);\n```\n...where `sources` is an array of paths and `options` is an hashmap of options (see below). Returns `outfiles`, which will be an array of `{path, text}` objects. You can pass this directly to `rosetta.writeFiles()`.\n\n`options` are the same as those for the command-line API.\n\n```js\nrosetta.writeFiles([{path, text}]);\n```\n`writeFiles` will actually write all of the compiled files to disk, creating directories as necessary.\n\n```js\nrosetta.formatError(e)\n```\nConverts a Rosetta error object into human-readable error string, including a snipper of the code that generated the error. Most useful when printing errors from `rosetta.compile`.\n\n## License\n\nLicensed under the MIT license.\nhttp://github.com/7sempra/rosetta/blob/master/LICENSE-MIT","readmeFilename":"README.md","_id":"rosetta@0.3.0","dist":{"shasum":"88082dfcd6ec60ce69e8f4e05a5cc0a4458cb406","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-0.3.0.tgz","integrity":"sha512-OmdIMMwvwx9ThEDorDP8mI4CkiGoLl1OufimvMWTxJtRnV+ZdBnsyqlRbRqv/1x9fZzg1zeZSUS2BlyaZn+tEQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWNSA/osOnxWdZuiSmxo7XiLIoJ1r1osiGUSi/iqna9gIgebfkV0mzvDwbhr/mtCFLPjFOGCgDFEVlCF0JfAUMSDc="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"7sempra","email":"net7runner@gmail.com"},"maintainers":[{"name":"7sempra","email":"net7runner@gmail.com"}],"directories":{}},"1.0.0":{"name":"rosetta","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/rosetta.git"},"description":"A general purpose internationalization library in 292 bytes","main":"dist/index.js","unpkg":"dist/index.min.js","module":"dist/index.mjs","types":"rosetta.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"keywords":["i18n","locale","localization","internationalization","translations","translate"],"modes":{"default":"src/index.js","debug":"src/debug.js"},"dependencies":{"dlv":"^1.1.3","templite":"^1.1.0"},"devDependencies":{"bundt":"1.0.0","esm":"3.2.25","tap-spec":"5.0.0","tape":"4.13.2"},"gitHead":"f3dc08cdaae3b07423ea7f0790d9b58bc08e20e6","bugs":{"url":"https://github.com/lukeed/rosetta/issues"},"homepage":"https://github.com/lukeed/rosetta#readme","_id":"rosetta@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-psAqCJwpUM6y4V7X5nVySKZUImOZZlxm5r+f3UqrbOldJWRhvIbydz9ov4C3NJ61x4yhXdUx6cswISyIQq+YnQ==","shasum":"d4783d8720b3fa195fe9a4894b6ce0928975fef8","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-1.0.0.tgz","fileCount":10,"unpackedSize":14627,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJejpMNCRA9TVsSAnZWagAAcrYP/1ke4JuAnBhXaLyI2a+F\nH43jz2ACSClp5u7vNWTgbQSXsCO0Kp1AKPLLbaPZmqChH8fc6LHSg02KeiBT\nfaL06zSeXkXtxRMgENrmTcKWV9FduQhpKBMQYS2nlcEscudSruWddcPOChS6\nCOJ00PK7Tzr02edJLMY334uYFkzi1B2icFYUUSavAcHBHnyDqh7eITNDqgd+\nch5D/ABE7WOIpvwOKwxV5TFE1C74TVSjywgcb/jVzqKhRACLGIX9hHJ6AcSS\nMKND9DcejbMO2RRXqWTSLNU2SFf4ogbPDT1cnBncfCBTkNgg1ceNyxRaeepl\nUYHPVVtb5c3+eJfuIzPE8ct5pPZwIUqFufunCSFXXvLT1C8HD1v9ehQ8jDwl\nXj+c2qUR4/QNHspWUI5SQM/Ehj5OejMFN4In2UPqiKM7MB5ZGO6OTjIJBsJD\ngOe95KNoV0dWAIDPOPUVumfxTVtqL8tsQU7+gdu7LLhHdJy0Uar3HVWYqYXa\nMJgSB5J7XQkW6lwX66MTHbxQGO8C09294IJ6HLdPoMeXLqhD8J1ZZRVROIMQ\n770T+mL2wPG5x+qkrBGjz3zjsf1lOmSWvkUJKON9OaUkRGFrmZaTwJrtw8t2\nFCi5XXeLNfmTmf8Liivob1scYK22STA1+GiXRn2gp5AU5zuqo4Pp+XdS4Vo/\nssSe\r\n=J3Fb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBQSqeXiCAQ6HghTNxiEaqdzyOOjaFQx89VJAmsdfaS9AiEA1UWMDX2rR1IZcJ7y7z9VIU15E8JbkReKXEUyNv0T2ws="}]},"maintainers":[{"email":"luke@lukeed.com","name":"lukeed"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosetta_1.0.0_1586402061244_0.4645666699171671"},"_hasShrinkwrap":false},"1.0.1":{"name":"rosetta","version":"1.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/rosetta.git"},"description":"A general purpose internationalization library in 292 bytes","main":"dist/index.js","unpkg":"dist/index.min.js","module":"dist/index.mjs","types":"rosetta.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"keywords":["i18n","locale","localization","internationalization","translations","translate"],"modes":{"default":"src/index.js","debug":"src/debug.js"},"dependencies":{"dlv":"^1.1.3","templite":"^1.1.0"},"devDependencies":{"bundt":"1.0.0","esm":"3.2.25","tap-spec":"5.0.0","tape":"4.13.2"},"gitHead":"bb9f793db9eb4462a89646511f0e3c71a8e874ce","bugs":{"url":"https://github.com/lukeed/rosetta/issues"},"homepage":"https://github.com/lukeed/rosetta#readme","_id":"rosetta@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-qfPYKyisROOvCpVhkZT3rTejjx6BmvAkkg/J7G0NN3jeniR5v8n3rDYhEVtmQ2spSmQMn9KRa9Ia+i8XVswgng==","shasum":"16b893019227e70e8e23ef8d1572250c28520e29","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-1.0.1.tgz","fileCount":10,"unpackedSize":14922,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4oYqCRA9TVsSAnZWagAARb8P/iZOPmJFz3tQiJPM1Wr+\nC1ywwcSOKg9UUMcwVmcDM9m20OrXbF2BCkxpKKgXbjMSXHvnMWoCli86xXQV\n7Rq2eSwt7TrX16vkHGpoZyC1SlkbHteen4Lx/I5m4r1uO9+/7WuaeU0gs93R\n3BU/6pXZpFwvZlSvGGQrCLy5f4BgKLIYiGKLJ+5EH3oc/R4Vq2vZHMw1PEIe\nyf5wwI0tRvhHaXb5NZualP7EN2sjTkKjI3GgbyWkSmMtXoYyHczcz+BvXDdP\n+RT8jSXFc+NG6WNn7H9y1nGen/F27HeP27FVybp0kMDlY5Wh9BthGv8JJjeZ\njDRvsGG/bkK2tuYhaPk8LrN8Eop609dYyQqQ6A+OeTDcVu2ia7LAT4Ytm8q3\nKXsyT+DBFqprlkyWA3meNmNBPv5yA23+ucPgO+zNlQLp4mQeAfDC4R/odvTK\nUP6l0lqix9A1So1V8s6HzAbV1gaQVrDZLRi5fqk8S50VNQjaRJnCD4BUcioh\nhBtDOm+ADevLuUGy2P/V65q1SA/p8bK/wyWIqO/uW8zvlb9JYfVayyyPTIkV\nQGjAULWvGZ+v+Qj3ZucuOJ6KPNMg8rbX/+GPjMpiKwU9/5O2p+mxNP15Vt5e\ntG0En2FXr4MFlLXKHoktWXwyb3zKCMLgmWhYaLG6tzr7voMuhE7Ca+QrKjDJ\nTiWK\r\n=Z2WE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICbIo3P+nUKLyKJ8ow3GojQ42KQYz0yKKkVzyI6XThIiAiEAjcRyrC5dlc77767R5cwG23mJl8cBnbCD3xrfVTni7bo="}]},"maintainers":[{"email":"luke@lukeed.com","name":"lukeed"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosetta_1.0.1_1591903786210_0.5347261309698339"},"_hasShrinkwrap":false},"1.1.0":{"name":"rosetta","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/rosetta.git"},"description":"A general purpose internationalization library in 298 bytes","main":"dist/index.js","unpkg":"dist/index.min.js","module":"dist/index.mjs","types":"rosetta.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"uvu -r esm test"},"keywords":["i18n","locale","localization","internationalization","translations","translate"],"modes":{"default":"src/index.js","debug":"src/debug.js"},"dependencies":{"dlv":"^1.1.3","templite":"^1.1.0"},"devDependencies":{"bundt":"1.0.2","esm":"3.2.25","uvu":"0.0.17"},"gitHead":"3701630115fd552dbdf1fea59ea324e04adc176e","bugs":{"url":"https://github.com/lukeed/rosetta/issues"},"homepage":"https://github.com/lukeed/rosetta#readme","_id":"rosetta@1.1.0","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-3jQaCo2ySoDqLIPjy7+AvN3rluLfkG8A27hg0virL0gRAB5BJ3V35IBdkL/t6k1dGK0TVTyUEwXVUJsygyx4pA==","shasum":"41ecc0f3cb38ce34b981b0dcfca2f4c94721738c","tarball":"https://registry.npmjs.org/rosetta/-/rosetta-1.1.0.tgz","fileCount":10,"unpackedSize":16819,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe+luKCRA9TVsSAnZWagAABDwP/02PyY2VMUx9um4dYhJf\nnNvJ5zdjsXICburFKIhArHdpFxIlXRVtSoCrRQCxiKGrJcr1lk1yQjSpvtCl\n+8QZAFzzdpGLWcJ+fzQrwmQH+WquuBg89jF4ivVF+rWo/oW8XPua2VW3Uzzv\nom1iwzDMRcGN4DznC0Rb85pgK3qC12uqUS1fZ9vJf1brGK2sK9fbcPo+7b3o\nOhXHoIcvzqodPn856egfJXBhkfA+/zXciPBZJgudnRu7DDr/yrOas4maY6Ee\nn+0mDRNx/8X75tNHgkkdtzNdEKIcIidqeApytHxpExZUmkQdpy07NAM3g18C\n1BvLwmRF3eGjEzzbcfmBKxxvf9KTOmnhjQ3t1Sic8buuxQ6Nj+D9Gob+HC65\nt9vNz37mDfLZOFW/Av45gwUPJiAcAObzbZ3l9Zq5NFw+aNK/nvCOqUD7K3Rt\n5B4vBk8U58g/pd+wS1zuscPGlly2X9zej5CVYIOVdYyhBgRXfoT2CW7VKjs8\nJfDMVZ/DZaDMh2vCtBUP5EdnMmPKU4Io/+nS9xObYFze7/XBuT/Utxegxa3Q\nI+M+KvfSTXgJ93XCTCbllpDSbhSXJ6trZJEQw0nZZZ7ElTfjdgkDwsoEKVmA\nmdZ4dIwRw97Gsvry5YpaubnhdDxAMU3ctlV52x8tpYy+26IEARpaaX6wmUZG\nW0hP\r\n=pHKM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGFs3F2WEtVXxsynuPnwHD+yq+LtK8bfHwBUM84iIV/GAiEAlCS5zpSlTYqwfUOyBaLk16hd5YWx2NLJqFFl6IpiGI8="}]},"maintainers":[{"email":"luke@lukeed.com","name":"lukeed"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rosetta_1.1.0_1593465737726_0.1295468346063744"},"_hasShrinkwrap":false}},"readme":"<div align=\"center\">\n  <img src=\"logo.jpg\" alt=\"rosetta\" height=\"130\" />\n</div>\n\n<div align=\"center\">\n  <a href=\"https://npmjs.org/package/rosetta\">\n    <img src=\"https://badgen.now.sh/npm/v/rosetta\" alt=\"version\" />\n  </a>\n  <a href=\"https://github.com/lukeed/rosetta/actions\">\n    <img src=\"https://github.com/lukeed/rosetta/workflows/CI/badge.svg\" alt=\"CI\" />\n  </a>\n  <a href=\"https://codecov.io/gh/lukeed/rosetta\">\n    <img src=\"https://badgen.net/codecov/c/github/lukeed/rosetta\" alt=\"codecov\" />\n  </a>\n</div>\n\n<div align=\"center\">A general purpose internationalization library in 298 bytes!</div>\n\n## Features\n\n* Simple and Familiar API\n* Unobstrusive and Unopinionated\n* Less than 300 bytes – including dependencies!\n\n\n## Install\n\n```\n$ npm install --save rosetta\n```\n\n\n## Usage\n\n```js\nimport rosetta from 'rosetta';\n\nconst i18n = rosetta({\n  en: {\n    intro: {\n      welcome: 'Welcome, {{username}}!',\n      text: 'I hope you find this useful.',\n    },\n    support(obj) {\n      let hour = Math.floor(Math.random() * 3) + 9;\n      let str = `For questions, I'm available on ${obj.date.toLocaleDateString()}`;\n      str += `, any time after ${hour}:00.`\n      return str;\n    }\n  }\n});\n\n// set default language\ni18n.locale('en');\n\n// add new language\ni18n.set('pt', {\n  intro: {\n    welcome: obj => `Benvind${obj.feminine ? 'a' : 'o'}, ${obj.username}!`,\n    text: 'Espero que você ache isso útil.'\n  }\n});\n\n// append extra key(s) to existing language\ni18n.set('pt', {\n  support(obj) {\n    let hour = Math.floor(Math.random() * 3) + 9;\n    let str = `Se tiver perguntas, estou disponível em ${obj.date.toLocaleDateString()}`;\n    str += `, qualquer hora depois às ${hour}:00.`\n    return str;\n  }\n});\n\nconst data = {\n  feminine: false,\n  username: 'lukeed',\n  date: new Date()\n};\n\n// Retrieve translations\n// NOTE: Relies on \"en\" default\ni18n.t('intro.welcome', data); //=> 'Welcome, lukeed!'\ni18n.t('intro.text', data); //=> 'I hope you find this useful.'\ni18n.t('support', data); //=> 'For questions, I'm available on 4/8/2020, any time after 11:00.'\n\n// Retrieve translations w/ lang override\ni18n.t('intro.welcome', data, 'pt'); //=> 'Benvindo, lukeed!'\n\n// Change default language key\ni18n.locale('pt');\n\n// Retrieve translations w/ new defaults\ni18n.t('intro.text', data); //=> 'Espero que você ache isso útil.'\ni18n.t('intro.text', data, 'en'); //=> 'I hope you find this useful.'\n```\n\n\n## API\n\n### rosetta(dict?)\nReturns: `Rosetta`\n\nInitializes a new `Rosetta` instance.<br>You may optionally provide an initial translation object.\n\n### rosetta.locale(lang?)\nReturns: `String`\n\nSets the language code for the `Rosetta` instance.<br>This will cause all [`rossetta.t()`](#rosettatkey-params-lang) lookups to assume this `lang` code.\n\nThe function will return the currently active `lang` code. This means that a setting a new value will reply with the same value. Additionally, calling `locale()` without any argument will return the `lang` code that the `Rosetta` instance was last given.\n\n#### lang\nType: `String`<br>\nRequired: `false`\n\nThe language code to choose.<br>\nIf `locale()` is called without an argument (or with a falsey value), then the current `lang` code is returned.\n\n### rosetta.set(lang, table)\n\nMerge (or override) translation keys into the `lang` collection.\n\n#### lang\nType: `String`\n\nThe language code to target.\n\n#### table\nType: `Object`\n\nA new record of key-values to merge into the `lang`'s dictionary.\n\nEach key within the `table` can correspond to a function or a string template.\n\nWhen using a function, it will receive the entire data input (see [`params`](#params)).<br>You are required to ensure the function returns a (string) value of your liking.\n\nWhen using a string template, anything within double curly brackets (`{{ example }}`) will be interpreted as a key path and interpolated via [`templite`](https://github.com/lukeed/templite). The key path can use dot-notation to access nested values from the data input (see [`params`](#params)). Additionally, if a key path did not resolve to a value, an empty string is injected.\n\n```js\nconst ctx = rosetta({\n  en: {\n    foo: (obj) => `function sees \"${obj.value || '~DEFAULT~'}\"`,\n    bar: 'template sees \"{{value}}\"'\n  }\n});\n\nctx.t('foo', {}, 'en');\n//=> 'function sees \"~DEFAULT~\"\nctx.t('foo', { value: 123 }, 'en');\n//=> 'function sees \"123\"\n\nctx.t('bar', {}, 'en');\n//=> 'template sees \"\"\nctx.t('bar', { value: 123 }, 'en');\n//=> 'template sees \"123\"\n```\n\n### rosetta.table(lang)\nReturns: `Object` or `undefined`\n\nRetrieve the the `lang`'s full dictionary/table of translation keys.\n\nIf the language does not exist (aka, no translations have been provided for it), you'll receive `undefined`.<br>Otherwise, you'll receive the full object as it exists within the `Rosetta` instance. See [`table`](#table).\n\n> **Important:** Manipulating this object is any way will mutate and affect your `Rosetta` instance. Be careful!\n\n#### lang\nType: `String`\n\nThe language code's table to retrieve.\n\n\n### rosetta.t(key, params?, lang?)\nReturns: `String`\n\nRetrieve the value for a given `key`.\n\n> **Important:** In the normal/default mode, an empty string will be returned for unknown keys.<br>Conversely, in [\"debug\" mode](#debugging), an error message will be printed and `undefined` will be returned for unknown keys.\n\n#### key\nType: `String` or `Array<String|Number>`\n\nThe identifier to retrieve.\n\nA `key` can access nested properties via:\n\n* a string that with dot notation &mdash; `'foo.bar[1].baz'`\n* an array of individual key segments &mdash; `['foo', 'bar', 1, 'baz']`\n\n> **Important:** You are expected to know & traverse your own dictionary structure correctly.\n\n```js\nconst ctx = rosetta({\n  en: {\n    fruits: {\n      apple: 'apple',\n    }\n  }\n});\n\nctx.locale('en');\n\nctx.t('fruits.apple'); //=> 'apple'\nctx.t(['fruits', 'apple']); //=> 'apple'\n```\n\n### params\nType: `any`<br>\nOptional: `true`\n\nThe data object argument to pass your dictionary keys' string templates and/or functions.\n\n> **Note:** If your *string template* tries to access a key that doesn't exist, an empty string is injected.\n\n```js\nconst ctx = rosetta({\n  es: {\n    hello: '¡Hola {{name}}!'\n  },\n  en: {\n    hello(obj) {\n      return obj.name === 'lukeed' ? 'wazzzuppp' : `Hello, ${obj.name}!`;\n    },\n  },\n  pt: {\n    hello: 'Oi {{person}}, tudo bem?' // <-- key is wrong\n  },\n});\n\nconst user1 = { name: 'lukeed' };\nconst user2 = { name: 'Billy' };\n\nctx.t('hello', user1, 'es'); //=> '¡Hola lukeed!'\n\nctx.t('hello', user1, 'en'); //=> 'wazzzuppp'\nctx.t('hello', user2, 'en'); //=> 'Hello, Billy!'\n\nctx.t('hello', user1, 'pt'); //=> 'Oi , tudo bem?'\n```\n\n### lang\nType: `String`<br>\nOptional: `true`\n\nA language code override without changing the entire `Rosetta` instance's default language.\n\n```js\nconst ctx = rosetta();\n\nctx.locale('en'); //=> set default\n\nctx.t('greeting', 'lukeed');\n//=> (en) 'Hello lukeed!'\nctx.t('greeting', 'lukeed', 'es');\n//=> (es) '¡Hola lukeed!'\nctx.t('bye');\n//=> (en) 'Cya'\n```\n\n## Debugging\n\nThere is a \"debug\" mode included for **development** environments.\n\nThe **only** difference with \"debug\" mode is that [`rossetta.t()`](#rosettatkey-params-lang) will log an error to the console when attempting to access a `key` that does not exist. Conversely, the main/default runtime will quietly return an an empty string for consistent output.\n\nOtherwise, the [API](#api) is _exactly_ the same as the main/default export!<br>This makes it easy to alias or swap the versions for development vs production bundles. Checkout the [Configuration](#configuration) section below for recipes.\n\n```js\n// debug mode\nimport rosetta from 'rosetta/debug';\n\nconst i18n = rosetta({\n  en: {\n    hello: 'hello'\n  }\n});\n\ni18n.locale('en');\n\ni18n.t('hello');\n//=> 'hello'\n\ni18n.t('foobar');\n// [rosetta] Missing the \"foobar\" key within the \"en\" dictionary\n//=> undefined\n```\n\n> **Note:** With the non-\"debug\" runtime, an empty string would be returned for the `foobar` key.\n\n#### Configuration\n\nHere are quick configuration recipes for Rollup and webpack that allow you to choose the right version of `rosetta` for your current environment _without changing you application code_.\n\nWith both recipes, you will import `rosetta` like this:\n\n```js\nimport rosetta from 'rosetta';\n```\n\nIt is up to the bundler to change what `'rosetta'` resolves to...\n\n***Rollup***\n\nYou will need to install [`@rollup/plugin-alias`](https://github.com/rollup/plugins/tree/master/packages/alias) before continuing.\n\n```js\nconst isDev = /*custom logic*/ || !!process.env.ROLLUP_WATCH;\n\nexport default {\n  // ...,\n  plugins: [\n    // ...\n    require('@rollup/plugin-alias')({\n      entries: {\n        rosetta: isDev ? 'rosetta/debug' : 'rosetta'\n      }\n    })\n  ]\n}\n```\n\n***webpack***\n\nThe ability to add aliases within webpack comes by default.<br>One simply needs to add a [`resolve.alias`](https://webpack.js.org/configuration/resolve/#resolvealias) value depending on the environment:\n\n```js\nconst isDev = /*specific to your config*/;\n\nmodule.exports = {\n  //...,\n  resolve: {\n    alias: {\n      // ...,\n      rosetta: isDev ? 'rosetta/debug' : 'rosetta'\n    }\n  }\n}\n```\n\n\n## Runtime Support\n\nThe library makes use of [Object shorthand methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions#Browser_compatibility) and [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Browser_compatibility).<br>This yields the following support matrix:\n\n| Chrome | Safari | Firefox | Edge | IE | Node.js |\n|:---:|:--:|:---:|:---:|:---:|:----:|\n| 45+ | 9+ | 34+ | 12+ | :x: | 4.0+ |\n\nIf you need to support older platforms, simply attach `rosetta` to your project's Babel (or similar) configuration.\n\n## Examples\n\n* [**Using Next.js**](https://github.com/zeit/next.js/tree/canary/examples/with-i18n-rosetta) &mdash; Thank you [@SharpTech](https://github.com/StarpTech)<br>_Official Next.js example using React Hooks and Context to provide SSR, SSG, CSR compatible i18n solutions._\n\n## Credits\n\nThank you [@7sempra](https://github.com/7sempra) for gifting the `rosetta` name on npm.\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","maintainers":[{"email":"luke@lukeed.com","name":"lukeed"}],"time":{"modified":"2022-06-26T14:12:33.815Z","created":"2013-03-10T22:19:20.737Z","0.1.0":"2013-03-10T22:19:22.566Z","0.1.1":"2013-03-21T02:35:25.100Z","0.2.0":"2013-09-23T03:01:31.107Z","0.3.0":"2013-11-30T18:30:02.745Z","1.0.0":"2020-04-09T03:14:21.350Z","1.0.1":"2020-06-11T19:29:46.357Z","1.1.0":"2020-06-29T21:22:17.845Z"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/rosetta.git"},"users":{"wesleycoder":true},"homepage":"https://github.com/lukeed/rosetta#readme","keywords":["i18n","locale","localization","internationalization","translations","translate"],"bugs":{"url":"https://github.com/lukeed/rosetta/issues"},"license":"MIT","readmeFilename":"readme.md"}