diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..bdbe522 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +pnpm exec oxfmt --write src/ diff --git a/.oxfmtrc.jsonc b/.oxfmtrc.jsonc new file mode 100644 index 0000000..106b6a0 --- /dev/null +++ b/.oxfmtrc.jsonc @@ -0,0 +1,9 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 100, + "singleQuote": true, + "semi": false, + "sortPackageJson": false, + "sortImports": true, + "ignorePatterns": ["dist", "node_modules"], +} diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..0584223 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,14 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["typescript", "unicorn", "oxc"], + "categories": { + "correctness": "error" + }, + "rules": { + "no-async-promise-executor": "off" + }, + "env": { + "builtin": true + }, + "ignorePatterns": ["dist", "node_modules"] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index d2e7fd2..0000000 --- a/.prettierignore +++ /dev/null @@ -1,6 +0,0 @@ -# Add files here to ignore them from prettier formatting - -dist -pnpm-lock.yaml - -CODEOWNERS diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 0ed410d..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - printWidth: 100, - singleQuote: true, - semi: false, -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 3662b37..4f4b981 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules/typescript/lib", + "js/ts.tsdk.path": "node_modules/typescript/lib" +} diff --git a/CLAUDE.md b/CLAUDE.md index 11b0c7a..3b74df4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -49,6 +49,7 @@ Two workarounds are in place (TODO: remove once [tsx#782](https://github.com/pri 2. **`dynamicAbsoluteImport`** in `sourceRelativeRspackModules.ts` — uses `new Function('specifier', 'return import(specifier)')` to preserve native `import()` at runtime, preventing tsc (CommonJS target) from converting `import()` to `require()`. Related issues: + - https://github.com/privatenumber/tsx/issues/781 - https://github.com/web-infra-dev/rspack/issues/13420 diff --git a/README.md b/README.md index 5bf8a45..2db8bd0 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,20 @@ npm install -D cypress-rspack-dev-server ## Usage ```ts -import { devServer } from "cypress-rspack-dev-server"; -import { defineConfig } from "cypress"; +import { devServer } from 'cypress-rspack-dev-server' +import { defineConfig } from 'cypress' export default defineConfig({ component: { devServer(devServerConfig) { return devServer({ ...devServerConfig, - framework: "react", - rspackConfig: require("./rspack.config.js"), - }); + framework: 'react', + rspackConfig: require('./rspack.config.js'), + }) }, }, -}); +}) ``` ## Dev server parameters @@ -74,15 +74,19 @@ async devServer(devServerConfig) { } ``` -## Migration to v1 +## Migration -In version 1, we supports the [Cypress 14 's justInTimeCompile](https://docs.cypress.io/app/references/changelog#14-0-0), the specs structure has been updated. +### v1 (Cypress 14+) + +In version 1, we support the [Cypress 14 's justInTimeCompile](https://docs.cypress.io/app/references/changelog#14-0-0), the specs structure has been updated. If you still use Cypress <= 13, please use the version 0.0.x. +### v2 (Rspack v2 support) + +In version 2, we support Rspack v2 (2.0.0-rc and above). If you are using Rspack v1, please use the version 1.x.x. + ## License [](https://github.com/cypress-io/cypress/blob/develop/LICENSE) This project is licensed under the terms of the [MIT license](/LICENSE). - -```` diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index eee8732..0000000 --- a/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'], -} diff --git a/cypress/component/Test.cy.tsx b/cypress/component/Test.cy.tsx index 9fae68b..56091f7 100644 --- a/cypress/component/Test.cy.tsx +++ b/cypress/component/Test.cy.tsx @@ -1,4 +1,5 @@ import React from 'react' + import { TestComponent } from './TestComponent' describe('Test.cy.tsx', () => { diff --git a/cypress/config/cypress.config.ts b/cypress/config/cypress.config.ts index 9b1cd10..1a4bd8b 100644 --- a/cypress/config/cypress.config.ts +++ b/cypress/config/cypress.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'cypress' + import { devServer } from '../../dist/devServer' export default defineConfig({ diff --git a/cypress/support/component-index.html b/cypress/support/component-index.html index 95b497b..940c9d1 100644 --- a/cypress/support/component-index.html +++ b/cypress/support/component-index.html @@ -1,15 +1,13 @@ - + +
+ + + +