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

Improve importing #534

Merged
merged 5 commits into from
Jan 14, 2020
Merged

Improve importing #534

merged 5 commits into from
Jan 14, 2020

Conversation

antfu
Copy link
Member

@antfu antfu commented Jan 14, 2020

Changes

Add importCache

To reuse the loaded files. (also hackable)


Nested import supported.

The current source file path will be included in importPaths now. This allows import from nested structures. Which is also very useful for 3rd-party modules.

For example, it makes importing 草部.wy from 讀經.wy possible.

├── 讀經.wy
└── 四庫全書
        ├── 本草綱目
        |       ├── 序.wy
        |       └── 草部.wy
        └── 序.wy

For more details, check out test/import.test.js and test/fixture/nest-import


Add importContext

The reader will search for the context first before searching fs/web resources. This is to replace the custom reader. The reader option will NOT exposing now.

IDE2 can also import user scripts now:

image


Test suits included

@LingDong-
Copy link
Member

Great! Thanks a lot!

@LingDong- LingDong- merged commit b3b4367 into wenyan-lang:master Jan 14, 2020
@antfu antfu mentioned this pull request Jan 17, 2020
LingDong- added a commit that referenced this pull request Jan 20, 2020
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.

2 participants