{"name":"pug-load","version":"3.0.0-canary-2","description":"The Pug loader is responsible for loading the depenendencies of a given Pug file.","keywords":["pug"],"dependencies":{"object-assign":"^4.1.1","pug-walk":"2.0.0-canary-2"},"devDependencies":{"pug-lexer":"5.0.0-canary-2","pug-parser":"6.0.0-canary-2"},"repository":{"type":"git","url":"https://github.com/pugjs/pug/tree/master/packages/pug-load"},"author":{"name":"ForbesLindesay"},"license":"MIT","readme":"# pug-load\n\nThe pug loader is responsible for loading the depenendencies of a given pug file.  It adds `fullPath` and `str` properties to every `Include` and `Extends` node.  It also adds an `ast` property to any `Include` nodes that are loading pug and any `Extends` nodes.  It then recursively loads the dependencies of any of those included files.\n\n[![Build Status](https://img.shields.io/travis/pugjs/pug-load/master.svg)](https://travis-ci.org/pugjs/pug-load)\n[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-load)](https://david-dm.org/pugjs/pug?path=packages/pug-load)\n[![DevDependencies Status](https://david-dm.org/pugjs/pug/dev-status.svg?path=packages/pug-load)](https://david-dm.org/pugjs/pug?path=packages/pug-load&type=dev)\n[![NPM version](https://img.shields.io/npm/v/pug-load.svg)](https://www.npmjs.org/package/pug-load)\n[![Coverage Status](https://img.shields.io/codecov/c/github/pugjs/pug-load.svg)](https://codecov.io/gh/pugjs/pug-load)\n\n## Installation\n\n    npm install pug-load\n\n## Usage\n\n```js\nvar load = require('pug-load');\n```\n\n### `load(ast, options)`\n### `load.string(str, filename, options)`\n### `load.file(filename, options)`\n\nLoads all dependencies of the Pug AST. `load.string` and `load.file` are syntactic sugar that parses the string or file instead of you doing it yourself.\n\n`options` may contain the following properties:\n\n- `lex` (function): **(required)** the lexer used\n- `parse` (function): **(required)** the parser used\n- `resolve` (function): a function used to override `load.resolve`. Defaults to `load.resolve`.\n- `read` (function): a function used to override `load.read`. Defaults to `load.read`.\n- `basedir` (string): the base directory of absolute inclusion. This is **required** when absolute inclusion (file name starts with `'/'`) is used. Defaults to undefined.\n\nThe `options` object is passed to `load.resolve` and `load.read`, or equivalently `options.resolve` and `options.read`.\n\n### `load.resolve(filename, source, options)`\n\nCallback used by `pug-load` to resolve the full path of an included or extended file given the path of the source file.\n\n`filename` is the included file. `source` is the name of the parent file that includes `filename`.\n\nThis function is not meant to be called from outside of `pug-load`, but rather for you to override.\n\n### `load.read(filename, options)`\n\nCallback used by `pug-load` to return the contents of a file.\n\n`filename` is the file to read.\n\nThis function is not meant to be called from outside of `pug-load`, but rather for you to override.\n\n### `load.validateOptions(options)`\n\nCallback used `pug-load` to ensure the options object is valid. If your overridden `load.resolve` or `load.read` uses a different `options` scheme, you will need to override this function as well.\n\nThis function is not meant to be called from outside of `pug-load`, but rather for you to override.\n\n### Example\n\n```js\nvar fs = require('fs');\nvar lex = require('pug-lexer');\nvar parse = require('pug-parser');\nvar load = require('pug-load');\n\n// you can do everything very manually\n\nvar str = fs.readFileSync('bar.pug', 'utf8');\nvar ast = load(parse(lex(str, 'bar.pug'), 'bar.pug'), {\n  lex: lex,\n  parse: parse,\n  resolve: function (filename, source, options) {\n    console.log('\"' + filename + '\" file requested from \"' + source + '\".');\n    return load.resolve(filename, source, options);\n  }\n});\n\n// or you can do all that in just two steps\n\nvar str = fs.readFileSync('bar.pug', 'utf8');\nvar ast = load.string(str, 'bar.pug', {\n  lex: lex,\n  parse: parse,\n  resolve: function (filename, source, options) {\n    console.log('\"' + filename + '\" file requested from \"' + source + '\".');\n    return load.resolve(filename, source, options);\n  }\n});\n\n// or you can do all that in only one step\n\nvar ast = load.file('bar.pug', {\n  lex: lex,\n  parse: parse,\n  resolve: function (filename, source, options) {\n    console.log('\"' + filename + '\" file requested from \"' + source + '\".');\n    return load.resolve(filename, source, options);\n  }\n});\n```\n\n## License\n\n  MIT\n","readmeFilename":"README.md","_id":"pug-load@3.0.0-canary-2","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-Sj+nz8jW3LllQzL6JAa00uz2d143kV86lz5VdkujbZ3B6ANHnbLYN/cr34YRkZwoA8r0d94/JhTELtuNm7rl3w==","shasum":"d9a159a35c08b9abb965d8dc39a6f3d1d7f69332","tarball":"http://registry-npm.ywwl.com/pug-load/download/pug-load-3.0.0-canary-2.tgz","fileCount":5,"unpackedSize":9366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJey7e7CRA9TVsSAnZWagAA4IUP/i2954RhEnYPZ8yuQCkG\npX3eIHYpNHoyV3H3s4nOUphSTSllw0XbEXxWz4GKCkdu0OtBIytzLD0Zh5fI\n0UE0icABaJ7FmQdBWAcnN2je40i+AiosLJnJ7Qw/xhJHOKX3IVZXsBY54WE1\nCsI/mlB+69AFuoPXv/BtseL8JvDjmZTEh9xHij0oS9ONjyibhjiHz13zTFWn\nCYzwZFd0zVJopUYGYgyGyiM+IUxpy9hNh05t4RqTtnNG1LAZAVOJ6Jck8gYf\n3ybgMNYZ1MZFUG7ngZG0vOgUux7WFPiIHI8yizNbNVdcRTLESiVueqhvXo+4\nR4wFIcsxiCpjyGqqWTQn1xv+IZa03p0LXycZDavRUvQ1FEw66FvyXZhiKVFR\ne4+MND/CzKEHqF2f5rt3+T9gefb1VxCHppM5BkAF4Glzbk3hR/Kwr1d70fZS\npCfViyj6yPlWtgWSE3E7aMu9ZD2Gd2FTbCymLsjbc8+kW3VrCLVzF0hW8c/P\nt8KXXjEW8wBepE+At5BazOl3HI15RxCZ+0oy3NCGnppHFzqekceIfximlcYm\n+t/zqiJhKxRDsAsqo6rOgv+0OncLWECUPMA5Vkad7G+Qbon1B9zIWohKFx7Q\nSp3/cFlVVnfci48LU2VzSq45EKa5qIYYdoB7zvAIZW38B9aXlFkqbGTSD9Uw\nr3oj\r\n=F+mn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDqyfqKxBIOgC2S88EF4P26JKhn4QJU5WXQSzpBayvbSwIgS9+7lte8cmKAdokNHoYdUVAVQkAWT/UOMsxVHyK7al8="}],"size":3358,"noattachment":false,"key":"/pug-load/-/pug-load-3.0.0-canary-2.tgz"},"maintainers":[{"email":"pug-bot@rollingversions.com","name":"pug-bot"},{"email":"timothygu99@gmail.com","name":"timothygu"}],"_npmUser":{"name":"pug-bot","email":"pug-bot@rollingversions.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pug-load_3.0.0-canary-2_1590409146843_0.7100370710127495"},"_hasShrinkwrap":false,"publish_time":1590409146969,"_cnpm_publish_time":1590409146969,"dist-tags":{"canary":"3.0.0-canary-2","latest":"3.0.0"}}