cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.71k stars 3.16k forks source link

Update to `parse5-html-rewriting-stream` 7.0.0 #30146

Open MikeMcC399 opened 2 weeks ago

MikeMcC399 commented 2 weeks ago

What would you like?

  1. Update the npm module parse5-html-rewriting-stream to parse5-html-rewriting-stream@v7.0.0.
  2. Remove the use of the deprecated npm module @types/parse5-html-rewriting-stream.

Why is this needed?

The npm module @types/parse5-html-rewriting-stream is deprecated. The release information for parse5@v7.0.0 shows that types were added in this feature release in November 2022. The Breaking: TypeScript section includes the text:

To migrate, please remove @types/parse5* as we now ship our own types.

Other

Item Value
Deprecated npm module @types/parse5-html-rewriting-stream
npm registry message This is a stub types definition. parse5-html-rewriting-stream provides its own type definitions, so you do not need this installed.
Other message
GitHub repo https://github.com/inikulin/parse5
Repo status Active
Replacement npm module https://www.npmjs.com/package/parse5-html-rewriting-stream
Replacement repo https://github.com/inikulin/parse5/tree/master/packages/parse5-html-rewriting-stream
Replacement documentation https://parse5.js.org/modules/parse5_html_rewriting_stream.html
Migration docs https://github.com/inikulin/parse5/releases/tag/v7.0.0

Where used:

Directory Version
packages/rewriter "@types/parse5-html-rewriting-stream": "5.1.1"
"parse5-html-rewriting-stream": "5.1.1"
raygdev commented 1 week ago
/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:851
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/raymo/projects/cypress/packages/rewriter/node_modules/parse5-html-rewriting-stream/dist/index.js from /Users/raymo/projects/cypress/packages/rewriter/lib/html.ts not supported.
Instead change the require of index.js in /Users/raymo/projects/cypress/packages/rewriter/lib/html.ts to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:851:20)
    at Object.<anonymous> (/Users/raymo/projects/cypress/packages/rewriter/lib/html.ts:5:40)
    at m._compile (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:857:29)
    at require.extensions.<computed> [as .ts] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:859:16)
    at Object.<anonymous> (/Users/raymo/projects/cypress/packages/rewriter/test/unit/html-spec.ts:5:16)
    at m._compile (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:857:29)
    at require.extensions.<computed> [as .ts] (/Users/raymo/projects/cypress/node_modules/ts-node/dist/index.js:859:16)
    at /Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/raymo/projects/cypress/node_modules/mocha/lib/mocha.js:514:10)
    at Object.<anonymous> (/Users/raymo/projects/cypress/node_modules/mocha/bin/_mocha:480:18) {
  code: 'ERR_REQUIRE_ESM'

I just don't have a good idea of how to get this to work.