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

safari exec error #9

Closed
linqunhe opened this issue Aug 20, 2021 · 2 comments
Closed

safari exec error #9

linqunhe opened this issue Aug 20, 2021 · 2 comments

Comments

@linqunhe
Copy link

import "/node_modules/.vite/chunk-R6I3GLEQ.js?v=1eb03933";

// node_modules/semver-regex/index.js
function semverRegex() {
  return /(?<=^v?|\sv?)(?:(?:0|[1-9]\d*)\.){2}(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/gi;
}

// node_modules/find-versions/index.js
function findVersions(stringWithVersions, { loose = false } = {}) {
  if (typeof stringWithVersions !== "string") {
    throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`);
  }
  const regex = loose ? new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, "g") : semverRegex();
  const matches = stringWithVersions.match(regex) || [];
  return [...new Set(matches.map((match) => match.trim().replace(/^v/, "").replace(/^\d+\.\d+$/, "$&.0")))];
}

// dep:find-versions
var find_versions_default = findVersions;
export {
  find_versions_default as default
};

safari can't resolve ?<= ; throw error

SyntaxError: Invalid regular expression: invalid group specifier name

but you package use semver-regex

@sindresorhus
Copy link
Owner

Safari lack some modern Regex features. While it works in most browsers, this package targets Node.js. It's up to you to polyfill/transpile or just stay on the previous version.

@linqunhe
Copy link
Author

@sindresorhus I've solved the problem. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants