Skip to content

feat: del old dsl export function #1434

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

Merged
merged 2 commits into from
May 28, 2025

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented May 26, 2025

English | 简体中文

PR 删除 DSL v1.x 出码导出函数

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

【问题背景】
原有的 DSL v1.x,是给 Nodejs 环境使用的。
所以在 packages/vue-generator/src/utils/vue-sfc-validator.js 中,直接对 vue-eslint-parser 进行了 require。

export function validateByParse(code) {
  // eslint-disable-next-line @typescript-eslint/no-require-imports
                              👇 这里直接对 vue-eslint-parser 进行了 require
  const { parse: parseVue } = require('vue-eslint-parser')
  let errors = []
  // ...
}

问题:

#1349 中,发布了 alpha 版本之后,二开工程打包,会报错:

error during build:
node_modules/.pnpm/@[email protected]/node_modules/@humanfs/node/src/node-hfs.js(24:9): "fiileURLToPath" is not exported by "__vite-browser-external", imported by .......

【问题分析】

  1. feat!: registry support hotfix #1349 中对所有的 @opentiny/tiny-enging-.* 都进行了 external,为了可以在用户二开工程做 tree-shaking。
  2. @opentiny/tiny-engine-dsl-vue 中指定了依赖 "vue-eslint-parser": "8.3.0",子依赖为 eslint。
  3. 在对所有的 @opentiny/tiny-enging-.* external 之前,tiny-engine 的 monorepo 工程解析 "vue-eslint-parser": "8.3.0" 的 eslint 子依赖版本为 8.57.1
  4. 对所有的 @opentiny/tiny-enging-.* external 之后,在用户的二开工程,"vue-eslint-parser": "8.3.0" 的 eslint 子依赖版本可能被解析为 9+。

eslint 9+ 的版本引入了 @HumanFS 相关的依赖,且没有正确解析 node:url 相关依赖。导致构建报错。

为什么未将所有的 @opentiny/tiny-enging-.* external 之前不会报错?

  1. 在对所有的 @opentiny/tiny-enging-.* external 之前,tiny-engine 的 monorepo 工程解析 "vue-eslint-parser": "8.3.0" 的 eslint 子依赖版本为 8.57.1
  2. 未 external 的时候,在 design-core 即 @opentiny/tiny-engine 打包阶段的时候,vue-eslint-parser package 就已经被 tree-shaking了,在用户二开工程不涉及该代码片段的重新打包。

【解决方案】
将 v1.x 的出码导出函数删除,这样在 @opentiny/tiny-engine-dsl-vue 打包阶段,就可以直接被 tree-shaking。

(后续确定 v1.x 导出函数不再被其他外部 package 引用,无副作用之后,将相关代码实现删除。

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Refactor
    • Streamlined available features by removing specific code generation options from the export list. Existing core functionality and other features remain unchanged for end-users.

Copy link
Contributor

coderabbitai bot commented May 26, 2025

Walkthrough

The changes remove the exports for generateCode, generateBlocksCode, and generatePageCode from both the generator module and the main index of the Vue generator package. Additionally, the explicit TypeScript declaration for generateCode was removed. Other exports remain unchanged, and no additional code modifications were made.

Changes

File(s) Change Summary
packages/vue-generator/src/generator/index.js Removed export of generateCode, generateBlocksCode, and generatePageCode from the ./page module.
packages/vue-generator/src/index.js Removed re-export of generateCode, generateBlocksCode, and generatePageCode from ./generator.
packages/vue-generator/src/index.d.ts Removed TypeScript export declaration of generateCode function.

Poem

The code that once would generate
Pages and blocks met a different fate.
Exports trimmed, the list is neat,
Only essentials now compete.
A rabbit hops and softly grins—
A tidy package always wins! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c495141 and e34e8ca.

📒 Files selected for processing (1)
  • packages/vue-generator/src/index.d.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/vue-generator/src/index.d.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request label May 26, 2025
@chilingling chilingling marked this pull request as ready for review May 26, 2025 06:38
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14b86d4 and c495141.

📒 Files selected for processing (2)
  • packages/vue-generator/src/generator/index.js (0 hunks)
  • packages/vue-generator/src/index.js (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/vue-generator/src/generator/index.js

@chilingling chilingling added the ready_for_review This PR requires more reviews label May 28, 2025
@hexqi hexqi added this to the v2.6.0 milestone May 28, 2025
@hexqi hexqi merged commit 36a9e97 into opentiny:develop May 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready_for_review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants