Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump url-join from 4.0.1 to 5.0.0 #4517

Closed

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Apr 11, 2022

Bumps url-join from 4.0.1 to 5.0.0.

Release notes

Sourced from url-join's releases.

v5.0.0

New Features ✨

  • Package is now distributed in the ECMAScript module syntax (see #76).
  • Definitions for TypeScript are now included out of the box (see #74).

Enhancements 📝

  • The the NPM package size has been reduced (see #65).

Breaking Changes 💥

  • Support for all module formats besides ECMAScript modules have been dropped.

Migration 🚚

If you are a user of TypeScript you can remove @types/url-join from your project. The type definitions are now included in the package itself, so it is no longer required to keep a separate dependency around.

npm uninstall @types/url-join
Changelog

Sourced from url-join's changelog.

5.0.0 - 2022-03-23

Commits
  • adccb32 5.0.0
  • caaafed Change distributed code to use ECMAScript modules (#76)
  • 86eeb03 Mark package as free of side-effects (#75)
  • be56f57 Reduce package size by adding "files" field (#65)
  • 2cd46bc Add type definitions for TypeScript users (#74)
  • b85aec2 Regenerate package lockfile (#73)
  • eef95f3 Merge pull request #71 from jfromaniello/rename-to-main
  • 5a5db30 Bump conventional-changelog from 1.1.24 to 3.1.25
  • ab6a39a Bump mocha from 3.5.3 to 9.2.2
  • ea22d93 Rename master branch to 'main'
  • Additional commits viewable in compare view
Maintainer changes

This version was pushed to npm by jonkoops, a new releaser for url-join since your current version.


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [url-join](https://github.com/jfromaniello/url-join) from 4.0.1 to 5.0.0.
- [Release notes](https://github.com/jfromaniello/url-join/releases)
- [Changelog](https://github.com/jfromaniello/url-join/blob/main/CHANGELOG.md)
- [Commits](jfromaniello/url-join@v4.0.1...v5.0.0)

---
updated-dependencies:
- dependency-name: url-join
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Apr 11, 2022
@LaszloKecskes
Copy link
Contributor

LaszloKecskes commented Apr 14, 2022

The issue: after trying to run the application and the tests locally, both break, meaning that both the jest setup and the application setup are facing problems.

The tests give the following error:

 FAIL   Server  app/api/auth/specs/routes.spec.js
  ● Test suite failed to run

    Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /home/k/huridocs/repositories/uwazi/node_modules/url-join/lib/url-join.js:60
    export default function urlJoin() {
    ^^^^^^

    SyntaxError: Unexpected token 'export'

       6 | import svgCaptcha from 'svg-captcha';
       7 | import settings from 'api/settings';
    >  8 | import urljoin from 'url-join';
         | ^
       9 | import { DB } from 'api/odm';
      10 | import { config } from 'api/config';
      11 | import cors from 'cors';

      at Runtime.createScriptFromCode (../node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (api/auth/routes.js:8:1)

A 'yarn hot' gives this:

[4:26:58 PM] Starting compilation in watch mode...

internal/modules/cjs/loader.js:1102
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/k/huridocs/repositories/uwazi/node_modules/url-join/lib/url-join.js
require() of ES modules is not supported.
require() of /home/k/huridocs/repositories/uwazi/node_modules/url-join/lib/url-join.js from /home/k/huridocs/repositories/uwazi/app/api/services/ocr/OcrManager.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename url-join.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/k/huridocs/repositories/uwazi/node_modules/url-join/package.json.

    at new NodeError (internal/errors.js:322:7)
    at Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
    at Object.newLoader [as .js] (/home/k/huridocs/repositories/uwazi/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/home/k/huridocs/repositories/uwazi/app/api/services/ocr/OcrManager.ts:2:39)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module._compile (/home/k/huridocs/repositories/uwazi/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.newLoader [as .ts] (/home/k/huridocs/repositories/uwazi/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18) {
  code: 'ERR_REQUIRE_ESM'
}

After reading the following:

I have managed to run yarn-hot with https://www.npmjs.com/package/fix-esm (using in server.js after '@babel/register'). This does not fix the tests, and I do not think that using another package that overwrites a global function just to fix url-join is a good approach.

I've made a couple of attempts on the jest side based on the documentation, but I didn't find a working approach.

@LaszloKecskes
Copy link
Contributor

Closing in favour of #4562.

@LaszloKecskes
Copy link
Contributor

@dependabot ignore this dependency

@dependabot dependabot bot closed this Apr 28, 2022
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Apr 28, 2022

OK, I won't notify you about url-join again, unless you re-open this PR or update it yourself. 😢

@dependabot dependabot bot deleted the dependabot/npm_and_yarn/url-join-5.0.0 branch April 28, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants