cypress-rollup-preprocessor
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -0,1 +1,8 @@ | ||
## [0.6.1](https://github.com/lmarqs/cypress-rollup-preprocessor/compare/v0.6.0...v0.6.1) (2020-08-24) | ||
### Bug Fixes | ||
* output caching ([316f44d](https://github.com/lmarqs/cypress-rollup-preprocessor/commit/316f44dccda34476650187341c366cd0618d1551)) | ||
# [0.6.0](https://github.com/lmarqs/cypress-rollup-preprocessor/compare/v0.5.0...v0.6.0) (2020-08-22) | ||
@@ -2,0 +9,0 @@ |
@@ -15,3 +15,3 @@ "use strict";var n=require("rollup"),t=function(){return(t=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)}; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function e(n,t,e,r){return new(e||(e=Promise))((function(o,u){function i(n){try{l(r.next(n))}catch(n){u(n)}}function c(n){try{l(r.throw(n))}catch(n){u(n)}}function l(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(i,c)}l((r=r.apply(n,t||[])).next())}))}function r(n,t){var e,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(n,i)}catch(n){u=[6,n],r=0}finally{e=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var o={},u={};function i(e,r,i){var c,l=e.input.toString(),a=u[l]=null!==(c=u[l])&&void 0!==c?c:n.watch(t(t({},e),{output:r}));return i.on("close",function(n){return function(){var t;null===(t=u[n])||void 0===t||t.close(),delete u[n],delete o[n]}}(l)),a.on("event",function(n){var t=!0;return function(e){["END","ERROR"].includes(e.code)&&(t?t=!1:n.emit("rerun"))}}(i)),new Promise((function(n,t){a.on("event",function(n,t,e){return function(r){"BUNDLE_END"===r.code&&(o[n]=r.output[0],t(o[n])),"ERROR"===r.code&&(delete o[n],e(r.error))}}(l,n,t))}))}function c(t,o){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,n.rollup(t)];case 1:return[4,e.sent().write(o)];case 2:return e.sent(),[2,o.file.toString()]}}))}))}function l(n,t){return e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){return e=Object.assign({},n.rollupOptions,{input:t.filePath}),o={file:t.outputPath,format:"umd"},t.shouldWatch?[2,i(e,o,t)]:[2,c(e,o)]}))}))}module.exports=function(n){var t=this;return void 0===n&&(n={}),function(u){return e(t,void 0,void 0,(function(){var t;return r(this,(function(e){return[2,null!==(t=o[u.filePath])&&void 0!==t?t:l(n,u)]}))}))}}; | ||
***************************************************************************** */function e(n,t,e,r){return new(e||(e=Promise))((function(o,u){function i(n){try{l(r.next(n))}catch(n){u(n)}}function c(n){try{l(r.throw(n))}catch(n){u(n)}}function l(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(i,c)}l((r=r.apply(n,t||[])).next())}))}function r(n,t){var e,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(n,i)}catch(n){u=[6,n],r=0}finally{e=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var o={},u={};function i(i,l,a){var f;return e(this,void 0,void 0,(function(){var e,s;return r(this,(function(r){return e=c(i),s=u[e]=null!==(f=u[e])&&void 0!==f?f:n.watch(t(t({},i),{output:l})),a.on("close",function(n){return function(){var t;null===(t=u[n])||void 0===t||t.close(),delete u[n],delete o[n]}}(e)),s.on("event",function(n){var t=!0;return function(e){["END","ERROR"].includes(e.code)&&(t?t=!1:n.emit("rerun"))}}(a)),[2,new Promise((function(n,t){s.on("event",function(n,t,e){return function(r){"BUNDLE_END"===r.code&&(o[n]=r,t(r.output[0])),"ERROR"===r.code&&(o[n]=r,e(r.error))}}(e,n,t))}))]}))}))}function c(n){return n.input.toString()}function l(t,o){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,n.rollup(t)];case 1:return[4,e.sent().write(o)];case 2:return e.sent(),[2,o.file.toString()]}}))}))}function a(n,t){return e(this,void 0,void 0,(function(){var e,u,a;return r(this,(function(r){return e=Object.assign({},n.rollupOptions,{input:t.filePath}),(u=function(n){var t=o[c(n)];return"BUNDLE_END"===(null==t?void 0:t.code)?Promise.resolve(t.output[0]):"ERROR"===(null==t?void 0:t.code)?Promise.reject(t.error):null}(e))?[2,u]:(a={file:t.outputPath,format:"umd"},t.shouldWatch?[2,i(e,a,t)]:[2,l(e,a)])}))}))}module.exports=function(n){var t=this;return void 0===n&&(n={}),function(o){return e(t,void 0,void 0,(function(){return r(this,(function(t){return[2,a(n,o)]}))}))}}; | ||
//# sourceMappingURL=index.js.map |
/// <reference types="node" /> | ||
import { RollupOptions, OutputOptions, RollupWatcher } from 'rollup'; | ||
import { RollupOptions, OutputOptions } from 'rollup'; | ||
import { EventEmitter } from 'events'; | ||
export declare const watchersOutput: Record<string, string>; | ||
export declare const watchers: Record<string, RollupWatcher>; | ||
export declare function watch(rollupOptions: RollupOptions, outputOptions: OutputOptions, file: EventEmitter): Promise<string>; | ||
export declare function getWatcherCachedOutput(rollupOptions: RollupOptions): Promise<string> | null; |
{ | ||
"name": "cypress-rollup-preprocessor", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Cypress preprocessor for bundling JavaScript via rollup", | ||
@@ -13,4 +13,4 @@ "main": "dist/index.js", | ||
"lint:js": "eslint --ext .js,.jsx,.json,.ts,.tsx .", | ||
"lint:markdown": "markdownlint '**/*.md' --ignore node_modules --ignore CHANGELOG.md", | ||
"lint:yaml": "yamllint '**/*.{yaml,yml}' --ignore='node_modules/**/*'", | ||
"lint:markdown": "markdownlint '**/*.md' --ignore '**/node_modules/**/*' --ignore CHANGELOG.md", | ||
"lint:yaml": "yamllint '**/*.{yaml,yml}' --ignore='**/node_modules/**/*'", | ||
"release": "npx semantic-release", | ||
@@ -45,2 +45,3 @@ "pretest": "shx rm -rf test/_test-output", | ||
"chai-as-promised": "^7.1.1", | ||
"cypress": "^5.0.0", | ||
"eslint": "^7.7.0", | ||
@@ -71,3 +72,3 @@ "eslint-plugin-cypress": "^2.11.1", | ||
"peerDependencies": { | ||
"rollup": "^2.26.3" | ||
"rollup": "2.x" | ||
}, | ||
@@ -74,0 +75,0 @@ "files": [ |
@@ -6,3 +6,2 @@ # cypress-rollup-preprocessor | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/7b0c1699b09bf771af2b/test_coverage)](https://codeclimate.com/github/lmarqs/cypress-rollup-preprocessor/test_coverage) | ||
![David](https://img.shields.io/david/peer/lmarqs/cypress-rollup-preprocessor) | ||
@@ -42,2 +41,3 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
const rollupPreprocessor = require("cypress-rollup-preprocessor"); | ||
module.exports = (on) => { | ||
@@ -48,2 +48,7 @@ on("file:preprocessor", rollupPreprocessor()); | ||
### Examples | ||
- [Basic](https://github.com/lmarqs/cypress-rollup-preprocessor/tree/master/examples/basic) | ||
- [Using Typescript](https://github.com/lmarqs/cypress-rollup-preprocessor/tree/master/examples/typescript) | ||
## Options | ||
@@ -78,7 +83,6 @@ | ||
We are using [nodeunit](https://github.com/caolan/nodeunit) to test. To run | ||
tests, first install nodeunit and any dependencies via npm: | ||
To run tests, first install nodeunit and any dependencies via npm: | ||
```sh | ||
npm install | ||
npm ci | ||
``` | ||
@@ -92,4 +96,15 @@ | ||
## Inspiration | ||
Many test approaches and patterns were copied from: | ||
- <https://github.com/cypress-io/cypress-webpack-preprocessor> | ||
- <https://github.com/cypress-io/cypress-watch-preprocessor> | ||
## Alternatives | ||
- <https://github.com/bahmutov/cy-rollup> | ||
## License | ||
This project is licensed under the terms of the [MIT license](/LICENSE). |
22684
106
47
44