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

fix($core): transpile vuepress packages and md files (close #1606)(close #1990) #2064

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

meteorlxy
Copy link
Member

@meteorlxy meteorlxy commented Dec 6, 2019

Summary

Related to #1771

Fix #1606

Fix #1990

Before

// WRONG
/(@vuepress|vuepress-)\/^((?!node_modules).)*\.js$/.test('/a/b/@vuepress/core/lib/index.js')
// false

// CORRECT
/(@vuepress|vuepress-)\/^((?!node_modules).)*\.js$/.test('/a/b/@vuepress/core/node_modules/xxx/index.js')
// false

// WRONG
/(@vuepress|vuepress-)\/^((?!node_modules).)*\.js$/.test('/a/b/vuepress-plugin-xxx/lib/index.js')
// false

// CORRECT
/(@vuepress|vuepress-)\/^((?!node_modules).)*\.js$/.test('/a/b/vuepress-plugin-xxx/node_modules/xxx/index.js')
// false

After

// CORRECT
/(@vuepress\/[^\/]*|vuepress-[^\/]*)\/(?!node_modules).*\.js$/.test('/a/b/@vuepress/core/lib/index.js')
// true

// CORRECT
/(@vuepress\/[^\/]*|vuepress-[^\/]*)\/(?!node_modules).*\.js$/.test('/a/b/@vuepress/core/node_modules/xxx/index.js')
// false

// CORRECT
/(@vuepress\/[^\/]*|vuepress-[^\/]*)\/(?!node_modules).*\.js$/.test('/a/b/vuepress-plugin-xxx/lib/index.js')
// true

// CORRECT
/(@vuepress\/[^\/]*|vuepress-[^\/]*)\/(?!node_modules).*\.js$/.test('/a/b/vuepress-plugin-xxx/node_modules/xxx/index.js')
// false

cc @sodatea

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

@meteorlxy meteorlxy changed the title fix($core): transpile vuepress packages and md files fix($core): transpile vuepress packages and md files (close #1606)(close #1990) Dec 10, 2019
@kefranabg
Copy link
Collaborator

Nice 👍 Would be cool to have an extra review from @sodatea and @ulivz

@kefranabg kefranabg requested review from haoqunjiang and ulivz and removed request for haoqunjiang December 19, 2019 15:31
@mariofriz
Copy link

mariofriz commented Jan 6, 2020

This solves the transpilation issue but it doesn't work on Windows because of \ instead of / for folder separators.

I adapted the regex expression to make it work.

// transpile all core files
if (/(@vuepress[\/\\][^\/\\]*|vuepress-[^\/\\]*)[\/\\](?!node_modules).*\.js$/.test(filePath)) {
  return false
}

@meteorlxy

@meteorlxy
Copy link
Member Author

@mariofriz Thanks for catching this. I'll update it.

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