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

refactor: remove temp page files and load page component via bundler (close #1584) #1606

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

meteorlxy
Copy link
Member

@meteorlxy meteorlxy commented Sep 10, 2024

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Provide a description in this PR that addresses what the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. close #123).

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Documentation update
  • Other
  • Refactor

Description

Closes #1584

Changes:

  • refactor: remove temp page files and load page component via bundler
  • refactor(markdown): remove relativePathPrefix option from assetsPlugin
  • feat: support importing module via relative paths in page files
  • feat: support importing markdown as vue component

TODOs

  • HMR
  • Refactor dev watcher, update pages & pagesMap
  • Watch page deps and invalidate the cache

@meteorlxy meteorlxy changed the title refactor: remove temp page files and load page component via bundler refactor: remove temp page files and load page component via bundler (close #1584) Sep 10, 2024
@coveralls
Copy link

coveralls commented Sep 10, 2024

Pull Request Test Coverage Report for Build 11266089171

Details

  • 36 of 59 (61.02%) changed or added relevant lines in 13 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.1%) to 70.605%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/cli/src/commands/dev/handlePageUnlink.ts 0 1 0.0%
packages/core/src/app/appPrepare.ts 0 1 0.0%
packages/cli/src/commands/dev/handlePageAdd.ts 0 2 0.0%
packages/cli/src/commands/dev/handlePageChange.ts 0 2 0.0%
packages/core/src/app/prepare/preparePageChunk.ts 0 2 0.0%
packages/core/src/page/renderPageToVue.ts 19 34 55.88%
Totals Coverage Status
Change from base Build 11266064405: -1.1%
Covered Lines: 666
Relevant Lines: 934

💛 - Coveralls

@meteorlxy meteorlxy marked this pull request as ready for review September 11, 2024 13:37
Copy link
Member

@Mister-Hope Mister-Hope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ecosystem and downstream plugins need a new option, I would design it as onPageUpdate

Technically speaking, a plugin can get all pages in onInitialized lifecycle, but when a new page is added, changed or removed in devServer, a plugin cannot subscribe because page generating and extendsPage hook are all async, we are watching the temp files before this PR, but this workaround no longer works now.

So to let the plugin work well, the onPageUpdate should be:

onPageUpdated(app: App, type: 'add' | 'change' | 'remove', oldPage: Page | null, newPage: Page | null)

Or we can split it into 3 subscriber:

onPageAdded(app: App, newPage: Page | null)
onPageChanged(app: App, oldPage: Page, newPage: Page)
onPageRemoved(app: App, oldPage: Page)

@meteorlxy meteorlxy marked this pull request as draft September 13, 2024 04:59
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

Successfully merging this pull request may close these issues.

[Feature request] Recognize @source and maybe treat all @ started path as alias with markdown image
3 participants