-
-
Notifications
You must be signed in to change notification settings - Fork 32
feat: support definePage macro #223
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
Changes from all commits
2148864
5647578
2c0ebd3
bb362c3
554b1ee
e82f4de
b70a9d8
e2a9d86
21360b9
39b25a1
ff25642
e2bf94d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| // 使用 IntelliSense 了解相关属性。 | ||
| // 悬停以查看现有属性的描述。 | ||
| // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Debug Uni App H5", | ||
| "type": "node", | ||
| "request": "launch", | ||
| "cwd": "${workspaceFolder}/packages/playground", | ||
| "preLaunchTask": "npm: debug - packages/core", | ||
| "runtimeExecutable": "pnpm", | ||
| "runtimeArgs": ["run", "dev:h5"], | ||
| "console": "integratedTerminal", | ||
| "internalConsoleOptions": "neverOpen", | ||
| "env": { | ||
| "NODE_ENV": "development" | ||
| } | ||
| }, | ||
| { | ||
| "name": "Debug Uni App MP-Weixin", | ||
| "type": "node", | ||
| "request": "launch", | ||
| "cwd": "${workspaceFolder}/packages/playground", | ||
| "preLaunchTask": "npm: debug - packages/core", | ||
| "runtimeExecutable": "pnpm", | ||
| "runtimeArgs": ["run", "dev:mp-weixin"], | ||
| "console": "integratedTerminal", | ||
| "internalConsoleOptions": "neverOpen" | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /// <reference path="./client.d.ts" /> | ||
|
|
||
| export * from './dist' | ||
|
|
||
| export { default } from './dist' | ||
|
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConfirm default export exists in ./dist, or drop the default re-export Re-exporting default from './dist' will fail type resolution if the dist entry has no default export. Keep the named export star and only keep the default re-export if the compiled output exposes a default. Run this quick check: If no default is present, adjust this file: -export { default } from './dist'
+// export { default } from './dist' // keep only if './dist' provides a default export🏁 Script executed: #!/bin/bash
# Verify a default export exists in dist or source
rg -nP 'export\s+default\b' packages/core/dist 2>/dev/null || rg -nP 'export\s+default\b' packages/core/src || echo "No default export detected"Length of output: 230 Drop the default re-export in export { default } from './dist'will break downstream type resolution. Remove it (or add a default export in your build if you intended one). • Location: -export { default } from './dist'
+// export { default } from './dist' // removed—no default export in dist🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,11 +27,11 @@ | |
| "exports": { | ||
| ".": { | ||
| "import": { | ||
| "types": "./dist/index.d.mts", | ||
| "types": "./index.d.ts", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConsider the impact of changing type declaration exports. Moving type declarations from Let me verify if there's a corresponding Also applies to: 34-34, 44-44, 48-48 🏁 Script executed: #!/bin/bash
# Check if index.d.ts exists at the package root
fd -t f "^index\.d\.ts$" packages/core --max-depth 1
# Search for any direct imports from dist folder in TypeScript files
rg -n --type=ts "from\s+['\"]@uni-helper/vite-plugin-uni-pages/dist" -g '!node_modules/**' -g '!dist/**'
# Check if there's a build step that generates index.d.ts at root
rg -n "index\.d\.ts" packages/core/build.config.tsLength of output: 241 Ensure deep‐imports of type declarations remain compatible I confirmed that import { Foo } from '@uni-helper/vite-plugin-uni-pages/dist'will no longer find Action items to avoid a breaking change:
|
||
| "default": "./dist/index.mjs" | ||
| }, | ||
| "require": { | ||
| "types": "./dist/index.d.cts", | ||
| "types": "./index.d.ts", | ||
| "default": "./dist/index.cjs" | ||
| } | ||
| }, | ||
|
|
@@ -41,39 +41,47 @@ | |
| }, | ||
| "main": "./dist/index.cjs", | ||
| "module": "./dist/index.mjs", | ||
| "types": "./dist/index.d.ts", | ||
| "types": "./index.d.ts", | ||
| "files": [ | ||
| "client.d.ts", | ||
| "dist" | ||
| "dist", | ||
| "index.d.ts" | ||
| ], | ||
| "scripts": { | ||
| "build": "unbuild", | ||
| "stub": "unbuild --stub", | ||
| "debug": "cross-env NODE_ENV=development unbuild", | ||
| "prepublishOnly": "pnpm build" | ||
| }, | ||
| "peerDependencies": { | ||
| "vite": "^5.0.0" | ||
| }, | ||
| "dependencies": { | ||
| "@babel/generator": "^7.28.3", | ||
| "@babel/types": "^7.28.2", | ||
| "@uni-helper/uni-env": "^0.1.4", | ||
| "@vue/compiler-sfc": "3.4.21", | ||
| "ast-kit": "^2.1.2", | ||
| "chokidar": "^3.6.0", | ||
| "comment-json": "^4.2.5", | ||
| "debug": "^4.3.6", | ||
| "detect-indent": "^6.1.0", | ||
| "detect-newline": "^3.1.0", | ||
| "fast-glob": "^3.3.2", | ||
| "json5": "^2.2.3", | ||
| "kolorist": "^1.8.0", | ||
| "lodash.groupby": "^4.6.0", | ||
| "magic-string": "^0.30.11", | ||
| "unconfig": "^7.3.2", | ||
| "yaml": "^2.5.0", | ||
| "comment-json": "^4.2.5" | ||
| "yaml": "^2.5.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@antfu/utils": "^0.7.10", | ||
| "@types/babel__generator": "^7.27.0", | ||
| "@types/debug": "^4.1.12", | ||
| "@types/lodash.groupby": "^4.6.9", | ||
| "@types/node": "^20.15.0", | ||
| "cross-env": "^10.0.0", | ||
| "vite": "^5.4.1" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Ensure the preLaunch task uses pnpm, not npm
"preLaunchTask": "npm: debug - packages/core"relies on VS Code’s package manager setting. Ifnpm.packageManagerisn’t set topnpm, this will run via npm and may break a pnpm workspace.Option A: add a workspace setting
.vscode/settings.json:{ "npm.packageManager": "pnpm" }Option B: replace the preLaunch task with a shell task that invokes pnpm explicitly.
🏁 Script executed:
Length of output: 1526
Require pnpm for VS Code preLaunchTask
Your workspace has a
.vscode/settings.jsonbut it’s missing thenpm.packageManagersetting, so VS Code will default to using npm for"npm: debug - packages/core", which breaks pnpm workspaces.To resolve:
.vscode/settings.json, add the pnpm package manager setting:{ // …existing settings… "npm.packageManager": "pnpm" }.vscode/launch.json, around line 12):Either approach will ensure VS Code runs your debug task with pnpm rather than npm.
🤖 Prompt for AI Agents