{"_id":"@aredridel/cypress-rspack-preprocessor","name":"@aredridel/cypress-rspack-preprocessor","dist-tags":{"latest":"13.0.0"},"versions":{"13.0.0":{"name":"@aredridel/cypress-rspack-preprocessor","version":"13.0.0","description":"Cypress preprocessor for bundling JavaScript via rspack","private":false,"main":"dist","scripts":{"build":"rimraf dist && tsc || echo 'built, with errors'","check-ts":"tsc --noEmit","deps":"deps-ok && dependency-check --no-dev .","lint":"eslint --ext .js,.jsx,.ts,.tsx,.json, .","secure":"nsp check","semantic-release":"semantic-release","size":"npm pack --dry","test":"node ./scripts/test-webpack-5.js","test-debug":"node --inspect --debug-brk ./node_modules/.bin/_mocha","test-e2e":"mocha test/e2e/*.spec.*","test-unit":"mocha test/unit/*.spec.*","test-watch":"yarn test-unit & chokidar '**/*.(js|ts)' 'test/unit/*.(js|ts)' -c 'yarn test-unit'","watch":"rimraf dist && tsc --watch"},"dependencies":{"bluebird":"3.7.1","debug":"^4.3.4","lodash":"^4.17.20"},"devDependencies":{"@babel/core":"^7.25.2","@babel/preset-env":"^7.25.3","@rspack/core":"^1.0.3","@types/mocha":"9.0.0","@types/webpack":"^4.41.12","babel-loader":"^9.1.3","chai":"4.1.2","chalk":"3.0.0","chokidar-cli":"2.1.0","common-tags":"^1.8.2","cypress":"^13.14.2","dependency-check":"2.9.1","deps-ok":"1.4.1","find-webpack":"1.5.0","fs-extra":"^10.1.0","mocha":"^7.1.0","mockery":"2.1.0","proxyquire":"2.1.3","rimraf":"6.0.1","semantic-release":"22.0.12","sinon":"^9.0.0","sinon-chai":"^3.5.0","snap-shot-it":"7.9.2","ts-node":"^10.9.2"},"peerDependencies":{"@babel/core":"^7.25.2","@babel/preset-env":"^7.25.3","@rspack/core":"^1","babel-loader":"^8.3 || ^9"},"types":"dist","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cypress-io/cypress.git"},"homepage":"https://github.com/cypress-io/cypress/tree/develop/npm/webpack-preprocessor#readme","bugs":{"url":"https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm%3A%20%40cypress%2Fwebpack-preprocessor&template=1-bug-report.md&title="},"keywords":["cypress","cypress-plugin","cypress-preprocessor","webpack"],"nx":{"targets":{"build":{"dependsOn":["!@cypress/react18:build"],"outputs":["{projectRoot}/dist"]}}},"_id":"@aredridel/cypress-rspack-preprocessor@13.0.0","gitHead":"431d197edac517d48ad39c3b629e14739890ca2b","_nodeVersion":"20.12.2","_npmVersion":"10.2.5","dist":{"integrity":"sha512-a/a/EHyucrtY3esHr/EXF+zCPvoVYDVGrGiYaafiRCZKpjWqBq+xqtHbeMPLi2rJx2vW4tglXd91xsLdc5q03g==","shasum":"f4b94ddf9c46f81070cac186e5a9e18157814498","tarball":"https://registry.npmjs.org/@aredridel/cypress-rspack-preprocessor/-/cypress-rspack-preprocessor-13.0.0.tgz","fileCount":9,"unpackedSize":29536,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGWKEOdPdpmiP/5lT+dI+LFJ8A8w/Gexkh/0C0zi0dFWAiAbP2E0aeQoCeZAO5A0flOi7p1+7foaX7Z2lx+UAxzo1g=="}]},"_npmUser":{"name":"aredridel","email":"aredridel@dinhe.net"},"directories":{},"maintainers":[{"name":"aredridel","email":"aredridel@dinhe.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cypress-rspack-preprocessor_13.0.0_1725481165276_0.4332065949082071"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-04T20:19:25.144Z","13.0.0":"2024-09-04T20:19:25.460Z","modified":"2024-09-04T20:19:25.759Z"},"maintainers":[{"name":"aredridel","email":"aredridel@dinhe.net"}],"description":"Cypress preprocessor for bundling JavaScript via rspack","homepage":"https://github.com/cypress-io/cypress/tree/develop/npm/webpack-preprocessor#readme","keywords":["cypress","cypress-plugin","cypress-preprocessor","webpack"],"repository":{"type":"git","url":"git+https://github.com/cypress-io/cypress.git"},"bugs":{"url":"https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm%3A%20%40cypress%2Fwebpack-preprocessor&template=1-bug-report.md&title="},"license":"MIT","readme":"# Cypress Webpack Preprocessor\n\nCypress preprocessor for bundling JavaScript via webpack\n\n## Installation\n\n```sh\nnpm install --save-dev @cypress/webpack-preprocessor\n```\n\nThis package relies on the following [peer dependencies](https://docs.npmjs.com/files/package.json#peerdependencies):\n\n* @babel/core\n* @babel/preset-env\n* babel-loader\n* webpack\n\nIt is likely you already have these installed either directly or as a transient dependency, but if not, you will need to install them.\n\n```sh\nnpm install --save-dev @babel/core @babel/preset-env babel-loader webpack\n```\n\n## Compatibility\n\nThis version is only compatible with webpack 4.x+ and Babel 7.x+.\n\n* If you need webpack 2 or 3 support, use `@cypress/webpack-preprocessor` 1.x\n* If you need Babel 6 support, use `@cypress/webpack-preprocessor` <= 2.x\n\nBy default, this plugin (and all Cypress plugins) run in the Node version that is bundled with Cypress. Alternatively, you can use the Node found on your system by setting [nodeVersion: system](https://on.cypress.io/configuration#Node-version) configuration option. A common use case for using the system Node are native dependencies like `node-sass`.\n\n## Usage\n\nIn your project's [plugins file](https://on.cypress.io/guides/tooling/plugins-guide.html):\n\n```javascript\nconst webpackPreprocessor = require('@cypress/webpack-preprocessor')\n\nmodule.exports = (on) => {\n  on('file:preprocessor', webpackPreprocessor())\n}\n```\n\n## Examples\n\n- [use-webpack-5](https://github.com/cypress-io/cypress/tree/develop/system-tests/projects/webpack-preprocessor-webpack-5) shows how to use webpack-preprocessor with Webpack 5\n- [use-ts-loader](https://github.com/cypress-io/cypress/tree/develop/system-tests/projects/webpack-preprocessor-ts-loader) shows how to transpile TypeScript specs following [Webpack TypeScript guide](https://webpack.js.org/guides/typescript/)\n\n## Options\n\nPass in options as the second argument to `webpack`:\n\n```javascript\nconst webpackPreprocessor = require('@cypress/webpack-preprocessor')\n\nmodule.exports = (on) => {\n  const options = {\n    // send in the options from your webpack.config.js, so it works the same\n    // as your app's code\n    webpackOptions: require('../../webpack.config'),\n    watchOptions: {},\n  }\n\n  on('file:preprocessor', webpackPreprocessor(options))\n}\n```\n\n### webpackOptions\n\nObject of webpack options. Just `require` in the options from your `webpack.config.js` to use the same options as your app.\n\n**Default**:\n\n```javascript\n{\n  mode: 'development',\n  module: {\n    rules: [\n      {\n        test: /\\.jsx?$/,\n        exclude: [/node_modules/],\n        use: [{\n          loader: 'babel-loader',\n          options: {\n            presets: ['@babel/preset-env'],\n          },\n        }],\n      },\n    ],\n  },\n}\n```\n\nSource maps are **always enabled** unless explicitly disabled by specifying `devtool: false`.\n\nWebpack [mode](https://webpack.js.org/configuration/mode/) is set to `development` if not present. You can set `mode` to \"development\", \"production\" or \"none\".\n\n### use babelrc\n\nIf you have a `.babelrc` file and would like to use it, then you must delete `options.presets` from the default Webpack options\n\n```js\nconst webpackPreprocessor = require('@cypress/webpack-preprocessor')\nconst defaults = webpackPreprocessor.defaultOptions\nmodule.exports = (on) => {\n  delete defaults.webpackOptions.module.rules[0].use[0].options.presets\n  on('file:preprocessor', webpackPreprocessor(defaults))\n}\n```\n\n### watchOptions\n\nObject of options for watching. See [webpack's docs](https://webpack.js.org/configuration/watch).\n\n**Default**: `{}`\n\n### additionalEntries\n\nAn array of file path strings for additional entries to be included in the bundle.\n\nBy necessity, this preprocessor sets the entry point for webpack as the spec file or support file. The `additionalEntries` option allows you to specify more entry points in order to utilize webpack's [multi-main entry](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax). This allows runtime dependency resolution.\n\n**Default**: `[]`\n\n**Example**:\n\n```javascript\nconst webpackPreprocessor = require('@cypress/webpack-preprocessor')\n\nmodule.exports = (on) => {\n  const options = {\n    webpackOptions: require('../../webpack.config'),\n    additionalEntries: ['./app/some-module.js'],\n  }\n\n  on('file:preprocessor', webpackPreprocessor(options))\n}\n```\n\n## Modifying default options\n\nThe default options are provided as `webpack.defaultOptions` so they can be more easily modified.\n\nIf, for example, you want to update the options for the `babel-loader` to add the [stage-3 preset](https://babeljs.io/docs/plugins/preset-stage-3/), you could do the following:\n\n```javascript\nconst webpackPreprocessor = require('@cypress/webpack-preprocessor')\n\nmodule.exports = (on) => {\n  const options = webpackPreprocessor.defaultOptions\n  options.webpackOptions.module.rules[0].use[0].options.presets.push('babel-preset-stage-3')\n\n  on('file:preprocessor', webpackPreprocessor(options))\n}\n```\n\n## Debugging\n\nYou can see debug messages from this module by running with environment variable\n\n```\nDEBUG=cypress:webpack\n```\n\nYou can see Webpack bundle diagnostic output (timings, chunks, sizes) by running with environment variable\n\n```\nDEBUG=cypress:webpack:stats\n```\n![Webpack stats](images/webpack-stats.png)\n\n## Contributing\n\nUse the [version of Node that matches Cypress](https://github.com/cypress-io/cypress/blob/develop/.node-version).\n\nBuild the typescript files:\n\n```shell\nyarn build\n```\n\nWatch the typescript files and rebuild on file change:\n\n```shell\nyarn build --watch\n```\n\nRun all tests once:\n\n```shell\nnpm test\n```\n\nRun tests in watch mode:\n\n```shell\nnpm run test-watch\n```\n\n## License\n\nThis project is licensed under the terms of the [MIT license](/LICENSE.md).\n\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n\n## Changelog\n\n[Changelog](./CHANGELOG.md)\n","readmeFilename":"README.md"}