{"_id":"@_pearofducks/require-extension-hooks-vue","_rev":"1-3ddbb924ad0e957a07bb404500a43b8b","name":"@_pearofducks/require-extension-hooks-vue","dist-tags":{"latest":"3.0.0"},"versions":{"3.0.0":{"name":"@_pearofducks/require-extension-hooks-vue","version":"3.0.0","description":"Simple server parser for .vue files","main":"src/index.js","scripts":{"test":"ava","lint":"eslint src"},"ava":{"files":["spec/**/*.spec.js"],"source":["index.js"],"require":["./spec/helpers/setup.js"],"verbose":false,"concurrency":8,"timeout":"240s"},"repository":{"type":"git","url":"git+https://github.com/jackmellis/require-extension-hooks-vue.git"},"author":{"name":"Jack Ellis"},"license":"ISC","bugs":{"url":"https://github.com/jackmellis/require-extension-hooks-vue/issues"},"homepage":"https://github.com/jackmellis/require-extension-hooks-vue#readme","peerDependencies":{"require-extension-hooks":"^0.3.0"},"dependencies":{"@vue/component-compiler-utils":"^2.5.2","consolidate":"^0.15.0","postcss":"^7.0.0","postcss-modules-sync":"^1.0.0","source-map-support":"^0.5.8","vue-template-compiler":"^2.6.2"},"devDependencies":{"ava":"^1.2.1","browser-env":"^3.2.5","eslint":"^5.0.0","pug":"^2.0.3","require-extension-hooks":"^0.3.3","require-extension-hooks-babel":"^0.1.0","sinon":"^7.2.3","vue":"^2.5.17"},"gitHead":"dfcf2e2ef507c158c73b126a7fbaec164768a57b","_id":"@_pearofducks/require-extension-hooks-vue@3.0.0","_nodeVersion":"11.4.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-8kDBctxoFBat+r87SxIQeu5PlhJ9cBxPDwkN2lmmRWdmYZiGebmmgjIwGLAJAXo48av5t+8E+lwe6Pdt6ytTQQ==","shasum":"36db4391a20bc80dc4257218a1fe06e9e4763505","tarball":"https://registry.npmjs.org/@_pearofducks/require-extension-hooks-vue/-/require-extension-hooks-vue-3.0.0.tgz","fileCount":8,"unpackedSize":237975,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWpd8CRA9TVsSAnZWagAAK0sP/1wOYA06FIn/3AzsjiUA\nZDymr1/uxDTmW6Y+m+JO879bII5f/k9kIpKwme4kW1crRM70JAv6e0Ssy310\nswaqyP07erplMcLDcCq7uSbCRJy0kuKwqB0P9wh4eONRuMJmPRFwaWTHn065\ne0ShAdFwH53MS3kVjMj0ytxzoJECCR45WuTQ5c5nZte51JA3Q0vQbZ2+16u4\nQhQOsBHKD3kmMT/dWjQoap023cR6BQIrzCzWFdqcKdi0IzKTsSdfLmWXrcvL\nXnBHDmvGYIWK4WDDcubK9428K0t/5iLaBoQT6Znft86dD31h1ilD/LeXLoht\n7uqZj4oeKmqgCa80aZ46sBuDqigZ+xo9YtbRcaeEyIaWkD+j/z8s25EtV97W\n4lRhVIAYhq7GoYN9reTPLx8Md6gfoIoA7iaIXmPDZ//FSHDiaCFS9PAT8iTF\nG4awVJ05xvQ5FUn0VduCRpMFTh4XZ/CTzR02Sq9J1a8j0ftlxdIRMSQwSYfP\nQn3mt2qjjm3gxIMBtv4IGRal4AqemBwMIEgkUx7c9qYlnZAxw2D122Qk28sY\n1xhNk+CyOERLfZ5QdJJ3xPiDe2oI50mFeikBTR02VAUQ/3cCSIE302FYt9Ny\nnqP1Y8OazmjRJgV6jd/fXc6YU6sPnQTivkSn3bcHitYTGdlbCy+Pxw0o5uAC\nU7nq\r\n=JwGp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDS6NB2Ro4+JWs3gPsRPdoo195C8ShigNbmwJbgF3YO5AIgXZ9j2ZtTwIU7/z63xpuFV7QEEH5pE5MtilN9hW5FPsc="}]},"maintainers":[{"name":"pearofducks","email":"pearofducks+npm@gmail.com"}],"_npmUser":{"name":"pearofducks","email":"pearofducks+npm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/require-extension-hooks-vue_3.0.0_1549440891482_0.22071750155276204"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-06T08:14:51.310Z","3.0.0":"2019-02-06T08:14:51.622Z","modified":"2022-04-04T10:51:40.609Z"},"maintainers":[{"name":"pearofducks","email":"pearofducks+npm@gmail.com"}],"description":"Simple server parser for .vue files","homepage":"https://github.com/jackmellis/require-extension-hooks-vue#readme","repository":{"type":"git","url":"git+https://github.com/jackmellis/require-extension-hooks-vue.git"},"author":{"name":"Jack Ellis"},"bugs":{"url":"https://github.com/jackmellis/require-extension-hooks-vue/issues"},"license":"ISC","readme":"# require-extension-hooks-vue\nSimple parser for vue files  \n\nUsing require-extension-hooks you can load *.vue* files in node, extremely helpful for browserless unit testing.\n\n## Installation  \n`npm install require-extension-hooks require-extension-hooks-vue --save-dev`  \n\n## Usage  \n```javascript\nconst hooks = require('require-extension-hooks');\nhooks('vue').plugin('vue');\n\nlet component = require('./components/app.vue');\n```\n\n*rehv* will convert `<template>` blocks into render functions for you.\n\nYou can load external templates and scripts:\n```html\n<template src=\"./tpl.html\"/>\n<script src=\"./script.js\"/>\n```\n\nYou can also transpile templates in other languages:\n```html\n<template lang=\"pug\">...</template>\n```\nJust install the relevant library as you would for `vue-loader`:\n```\nnpm install pug --save-dev\n```\nand *rehv* will pick it up.\n\nFor scripts in other languages:\n```html\n<script lang=\"ts\">...</script>\n```\nYou will need to register a hook for that extension name:\n```javascript\nhooks('ts').push(function({content}){\n/* transpile your script code here */\n});\n```\n*There will likely be additional hook libraries for script languages available soon*\n\n## Custom Blocks\nIf you have custom blocks in your `.vue` files, you can parse then using `require-extension-hooks`.\nBlocks are available by hooking to the file type `vue-block-(block name)`. The hook should return\nJavaScript code, in a string, which will be appended to the compiled `.vue` file.\n\nA helper named `COMPONENT_OPTIONS` is available in on the plugin export to allow you to modify\nthe exported component options object from the `.vue` file.\n\nFor example, for a `<json></json>` block to have its data available via `this.json` in the\ncomponent, you could use a [mixin](https://vuejs.org/v2/guide/mixins.html):\n\n```javascript\nconst { COMPONENT_OPTIONS } = require('require-extension-hooks-vue');\nhooks('vue-block-json').push(({ content }) =>\n    `${COMPONENT_OPTIONS}.mixins = (${COMPONENT_OPTIONS}.mixins || []).concat({\n        data: () => ({\n            json: ${JSON.parse(content)}\n        })\n    });`\n);\n```\n\n## Register\nYou can automatically register the vue hook using the register file:\n```js\nrequire('require-extension-hooks-vue/register');\n```\nWhich means you can register the module from cli tools:\n```\nmocha --require require-extension-hooks-vue/register\n```\n\n## Configuration\nSet configuration options using the `configure` method:\n```js\nconst plugin = require('require-extension-hooks-vue');\nplugin.configure({ transpileTemplates: false });\n```\n\n### transpileTemplates\n`true`  \nwhether or not to automatically transpile templates that have a `lang` attribute\n\n### sourceMaps\n`true`  \nwhether or not to set up source map support. This utilises the `source-map-support` library.\n","readmeFilename":"README.md"}