Skip to content

Commit a5446a3

Browse files
Merge branch 'main' into feat-effect
2 parents df77be4 + 0a8be45 commit a5446a3

File tree

6 files changed

+45
-101
lines changed

6 files changed

+45
-101
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@rollup/plugin-replace": "^5.0.2",
6767
"@rollup/plugin-terser": "^0.4.3",
6868
"@types/hash-sum": "^1.0.0",
69-
"@types/node": "^16.18.52",
69+
"@types/node": "^18.18.5",
7070
"@typescript-eslint/parser": "^6.7.2",
7171
"@vitest/coverage-istanbul": "^0.34.4",
7272
"@vue/consolidate": "0.17.3",
@@ -84,7 +84,7 @@
8484
"lodash": "^4.17.21",
8585
"magic-string": "^0.30.3",
8686
"markdown-table": "^3.0.3",
87-
"marked": "^4.3.0",
87+
"marked": "^9.1.1",
8888
"minimist": "^1.2.8",
8989
"npm-run-all": "^4.1.5",
9090
"prettier": "^3.0.3",

packages/runtime-core/src/index.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,13 @@ export {
7373
defineSlots,
7474
defineModel,
7575
withDefaults,
76-
useModel,
77-
// internal
76+
useModel
77+
} from './apiSetupHelpers'
78+
79+
/**
80+
* @internal
81+
*/
82+
export {
7883
mergeDefaults,
7984
mergeModels,
8085
createPropsRestProxy,
@@ -111,7 +116,9 @@ export { useSSRContext, ssrContextKey } from './helpers/useSsrContext'
111116

112117
export { createRenderer, createHydrationRenderer } from './renderer'
113118
export { queuePostFlushCb } from './scheduler'
114-
export { warn, assertNumber } from './warning'
119+
export { warn } from './warning'
120+
/** @internal */
121+
export { assertNumber } from './warning'
115122
export {
116123
handleError,
117124
callWithErrorHandling,

packages/vue/__tests__/e2e/markdown.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('e2e: markdown', () => {
1313
await page().goto(baseUrl)
1414
expect(await isVisible('#editor')).toBe(true)
1515
expect(await value('textarea')).toBe('# hello')
16-
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
16+
expect(await html('#editor div')).toBe('<h1>hello</h1>\n')
1717

1818
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
1919

@@ -23,8 +23,8 @@ describe('e2e: markdown', () => {
2323

2424
await expectByPolling(
2525
() => html('#editor div'),
26-
'<h1 id="hello">hello</h1>\n' +
27-
'<h2 id="foo">foo</h2>\n' +
26+
'<h1>hello</h1>\n' +
27+
'<h2>foo</h2>\n' +
2828
'<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n'
2929
)
3030
}

pnpm-lock.yaml

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rollup.dts.config.js

+6-70
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { parse } from '@babel/parser'
33
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'fs'
44
import MagicString from 'magic-string'
55
import dts from 'rollup-plugin-dts'
6-
import { walk } from 'estree-walker'
76

87
if (!existsSync('temp/packages')) {
98
console.warn(
@@ -41,12 +40,11 @@ export default targetPackages.map(pkg => {
4140

4241
/**
4342
* Patch the dts generated by rollup-plugin-dts
44-
* 1. remove exports marked as @internal
45-
* 2. Convert all types to inline exports
43+
* 1. Convert all types to inline exports
4644
* and remove them from the big export {} declaration
4745
* otherwise it gets weird in vitepress `defineComponent` call with
4846
* "the inferred type cannot be named without a reference"
49-
* 3. Append custom augmentations (jsx, macros)
47+
* 2. Append custom augmentations (jsx, macros)
5048
* @returns {import('rollup').Plugin}
5149
*/
5250
function patchTypes(pkg) {
@@ -73,64 +71,12 @@ function patchTypes(pkg) {
7371
return
7472
}
7573
shouldRemoveExport.add(name)
76-
if (!removeInternal(parentDecl || node)) {
77-
if (isExported.has(name)) {
78-
// @ts-ignore
79-
s.prependLeft((parentDecl || node).start, `export `)
80-
}
81-
// traverse further for internal properties
82-
if (
83-
node.type === 'TSInterfaceDeclaration' ||
84-
node.type === 'ClassDeclaration'
85-
) {
86-
node.body.body.forEach(removeInternal)
87-
} else if (node.type === 'TSTypeAliasDeclaration') {
88-
// @ts-ignore
89-
walk(node.typeAnnotation, {
90-
enter(node) {
91-
// @ts-ignore
92-
if (removeInternal(node)) this.skip()
93-
}
94-
})
95-
}
74+
if (isExported.has(name)) {
75+
// @ts-ignore
76+
s.prependLeft((parentDecl || node).start, `export `)
9677
}
9778
}
9879

99-
/**
100-
* @param {import('@babel/types').Node} node
101-
* @returns {boolean}
102-
*/
103-
function removeInternal(node) {
104-
if (
105-
node.leadingComments &&
106-
node.leadingComments.some(c => {
107-
return c.type === 'CommentBlock' && /@internal\b/.test(c.value)
108-
})
109-
) {
110-
/** @type {any} */
111-
const n = node
112-
let id
113-
if (n.id && n.id.type === 'Identifier') {
114-
id = n.id.name
115-
} else if (n.key && n.key.type === 'Identifier') {
116-
id = n.key.name
117-
}
118-
if (id) {
119-
s.overwrite(
120-
// @ts-ignore
121-
node.leadingComments[0].start,
122-
node.end,
123-
`/* removed internal: ${id} */`
124-
)
125-
} else {
126-
// @ts-ignore
127-
s.remove(node.leadingComments[0].start, node.end)
128-
}
129-
return true
130-
}
131-
return false
132-
}
133-
13480
const isExported = new Set()
13581
const shouldRemoveExport = new Set()
13682

@@ -146,7 +92,7 @@ function patchTypes(pkg) {
14692
}
14793
}
14894

149-
// pass 1: remove internals + add exports
95+
// pass 1: add exports
15096
for (const node of ast.program.body) {
15197
if (node.type === 'VariableDeclaration') {
15298
processDeclaration(node.declarations[0], node)
@@ -167,10 +113,6 @@ function patchTypes(pkg) {
167113
node.type === 'ClassDeclaration'
168114
) {
169115
processDeclaration(node)
170-
} else if (removeInternal(node)) {
171-
throw new Error(
172-
`unhandled export type marked as @internal: ${node.type}`
173-
)
174116
}
175117
}
176118

@@ -213,12 +155,6 @@ function patchTypes(pkg) {
213155
}
214156
code = s.toString()
215157

216-
if (/@internal/.test(code)) {
217-
throw new Error(
218-
`unhandled @internal declarations detected in ${chunk.fileName}.`
219-
)
220-
}
221-
222158
// append pkg specific types
223159
const additionalTypeDir = `packages/${pkg}/types`
224160
if (existsSync(additionalTypeDir)) {

tsconfig.build.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"declaration": true,
5-
"emitDeclarationOnly": true
5+
"emitDeclarationOnly": true,
6+
"stripInternal": true
67
},
78
"exclude": [
89
"packages/*/__tests__",

0 commit comments

Comments
 (0)