yui-pathogen-encoder
Version:
Enables pathogen encoding in YUI Loader
79 lines (78 loc) • 7.14 kB
JSON
{
"name": "locator",
"description": "gives semantic meaning to filesystem paths",
"version": "0.3.5",
"homepage": "https://github.com/yahoo/locator",
"keywords": [
"filesystem",
"fs",
"mojito",
"modown"
],
"repository": {
"type": "git",
"url": "https://github.com/yahoo/locator.git"
},
"author": {
"name": "Drew Folta",
"email": "folta@yahoo-inc.com"
},
"contributors": [
{
"name": "Isao Yagi",
"email": "isao@yahoo-inc.com"
},
{
"name": "Michael Ridgway",
"email": "mridgway@yahoo-inc.com"
},
{
"name": "Caridy Patino",
"email": "caridy@yahoo-inc.com",
"url": "http://github.com/caridy"
},
{
"name": "alberto chan",
"email": "albertoc@yahoo-inc.com"
}
],
"license": "BSD",
"main": "lib/bundleLocator.js",
"directories": {
"lib": "./lib"
},
"engines": {
"node": ">0.8",
"npm": ">1.0"
},
"dependencies": {
"async": "*",
"mkdirp": "0.3.x",
"scanfs": "~0.1.0",
"semver": "~1.1.4",
"watch": "0.6.x",
"yui": "3.10.x"
},
"devDependencies": {
"chai": "~1.6.1",
"istanbul": "*",
"jshint": "~0.9.0",
"mocha": "*",
"mockery": "1.4.x",
"xunit-file": "*",
"yui-lint": "~0.1.3"
},
"scripts": {
"cover": "istanbul cover -- _mocha tests/lib/*.js --reporter spec",
"lint": "jshint --config node_modules/yui-lint/jshint.json lib/*.js tests/lib/*.js",
"pretest": "jshint --config node_modules/yui-lint/jshint.json lib/*.js tests/lib/*.js",
"test": "_mocha tests/lib/*.js --reporter spec"
},
"readme": "locator\n=======\n\nThe locator gives semantic meaning to files on the filesystem.\nIt does this with a set of \"rules\" that describes how each file path should be interpreted.\nIn addition it groups files into \"bundles\".\n(Each bundle is usually an NPM module, but not always.)\n\nThe locator doesn't _interpret_ the semantic meaning of the files.\nIt is up to the user to understand and use the semantic meanings associated with the files.\n\n[](https://travis-ci.org/yahoo/locator)\n\n\n## Goals & Design\n* provide an abstraction over filesystem paths\n * set of \"rules\" (regexps basically) that determine the semantic meaning of each file\n * files that match a rule (and thus have semantic meaning) are called \"resources\"\n * built-in handling of \"selectors\", for resources that have multiple versions\n* organize files in bundles\n * bundles are usually NPM modules\n * ...but can be something else, if an NPM module delivers multiple child bundles\n * bundles are recursively walked, since they are often organized in a tree structure on disk\n * bundles can have different types\n * for example, a mojito application bundle is walked differently (uses a different ruleset) than a mojito mojit bundle\n * each bundle can declare its type in its `package.json` (for those bundles that are NPM modules)\n * each bundle can also describe the type of child bundles found at certain paths (for e.g. mojito application that has mojit bundles at a certain place)\n* configurable\n * the behavior of the locator should be configurable, which should include\n * ...defining new rulesets, for new bundle types\n * ...general runtime behavior configuration of returned values\n * ...etc\n* extensible (plugins)\n * the locator also allows \"plugins\" to be informed about files/resources/bundles\n * one type of plugin is a \"compiler\" which takes a file in an unknown format and \"compiles\" it into a known format\n * for example, a \"sass\" compiler which generates \"css\" files\n * other types of plugins can do general processing\n * for example, a \"config helper\" plugin could load config files and cache their contents in memory\n * other types of plugins can process a bundle as a whole\n * for example, a \"yui helper\" plugin which can generate YUI loader metadata for the whole bundle\n\n\n## Installation\nInstall using npm:\n\n```shell\n$ npm install locator\n```\n\n\n\n## Example: Mojito Application\nIn your app's `package.json`:\n```javascript\n{\n \"dependencies\": {\n ...\n \"mojito\": \"*\",\n ...\n },\n \"locator\": {\n \"rulesets\": \"mojito/locator-rulesets\"\n }\n}\n```\n\n\n## Example: Defining Your Own Semantics\nIn your app's `package.json`:\n```javascript\n{\n \"locator\": {\n \"rulesets\": \"locator-rulesets\"\n }\n}\n```\n\nA new `locator-rulesets.js` file which defines how to add semantic meaning to filesystem paths:\n```javascript\nmodule.exports = {\n // nameKey defaults to 1\n // selectorKey has no default. selector is only used if selectorKey is given\n main: {\n // we can use this to skip files\n _skip: [\n /^tests?\\b/i\n ],\n\n // where to find configuration files\n configs: {\n regex: /^configs\\/([a-z_\\-\\/]+)\\.(json|js)$/i\n },\n\n // where to find templates\n templates: {\n regex: /^templates\\/([a-z_\\-\\/]+)(\\.([\\w_\\-]+))?\\.[^\\.\\/]+\\.html$/i,\n // We use \"selectors\" because we might use different templates based\n // on different circumstances.\n selectorKey: 3\n },\n\n // where to find CSS files\n css: {\n regex: /^public\\/css\\/([a-z_\\-\\/]+)\\.css$/i\n }\n }\n};\n```\n\n\nThen, in your `app.js` (or wherever makes sense to you) you can do something like:\n```javascript\nvar Locator = require('locator');\n\nlocator = new Locator();\nlocator.parseBundle(__dirname).then(function() {\n var resources = locator.getRootBundle().getResources();\n\n // access your \"configs/foo.json\" configuration file\n ... resources.configs.foo ...\n\n // access all your templates\n Object.keys(resources.templates).forEach(function (templateName) {\n var templateResource = resources.templates[templateName];\n ...\n });\n\n // File watching is optional, and probably only desired when running in\n // a development environment.\n locator.watch(__dirname).then(function () {\n // File watching has started.\n // Actual changes will be reflected into the results of `getBundle()`,\n // `getRootBundle()`, `listAllResources()`, and `listBundleNames()`.\n // Changes are also reported (as they happen) to the locator plugins.\n });\n});\n```\n\n\n## License\nThis software is free to use under the Yahoo! Inc. BSD license.\nSee the [LICENSE file][] for license text and copyright information.\n\n[LICENSE file]: https://github.com/yahoo/locator/blob/master/LICENSE.txt\n\n\n## Contribute\nSee the [CONTRIBUTE.md file][] for info.\n\n[CONTRIBUTE.md file]: https://github.com/yahoo/locator/blob/master/CONTRIBUTE.md\n\n\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/yahoo/locator/issues"
},
"_id": "locator@0.3.5",
"_from": "locator@*"
}