Skip to content

Commit 79eddcc

Browse files
committed
build: use rolldown
1 parent 8bff142 commit 79eddcc

File tree

14 files changed

+1299
-457
lines changed

14 files changed

+1299
-457
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export default tseslint.config(
148148
files: [
149149
'eslint.config.js',
150150
'rollup*.config.js',
151+
'rolldown*.config.js',
151152
'scripts/**',
152153
'./*.{js,ts}',
153154
'packages/*/*.js',

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"scripts": {
77
"dev": "node scripts/dev.js",
88
"build": "node scripts/build.js",
9-
"build-dts": "tsc -p tsconfig.build.json --noCheck && rollup -c rollup.dts.config.js",
9+
"build-rollup": "node scripts/build-with-rollup.js",
10+
"build-dts": "node scripts/build-types.js",
11+
"build-dts-tsc": "tsc -p tsconfig.build.json --noCheck && rollup -c rollup.dts.config.js",
1012
"clean": "rimraf --glob packages/*/dist temp .eslintcache",
1113
"size": "run-s \"size-*\" && node scripts/usage-size.js",
1214
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
@@ -62,8 +64,8 @@
6264
"node": ">=18.12.0"
6365
},
6466
"devDependencies": {
65-
"@babel/parser": "catalog:",
6667
"@babel/types": "catalog:",
68+
"@rolldown/plugin-node-polyfills": "^1.0.0",
6769
"@rollup/plugin-alias": "^5.1.1",
6870
"@rollup/plugin-commonjs": "^28.0.1",
6971
"@rollup/plugin-json": "^6.1.0",
@@ -75,28 +77,32 @@
7577
"@types/semver": "^7.5.8",
7678
"@types/serve-handler": "^6.1.4",
7779
"@vitest/coverage-v8": "^2.1.1",
80+
"@vitest/eslint-plugin": "^1.0.1",
7881
"@vue/consolidate": "1.0.0",
7982
"conventional-changelog-cli": "^5.0.0",
8083
"enquirer": "^2.4.1",
8184
"esbuild": "^0.24.0",
8285
"esbuild-plugin-polyfill-node": "^0.3.0",
8386
"eslint": "^9.14.0",
8487
"eslint-plugin-import-x": "^4.4.0",
85-
"@vitest/eslint-plugin": "^1.0.1",
8688
"estree-walker": "catalog:",
89+
"fast-glob": "^3.3.2",
8790
"jsdom": "^25.0.0",
8891
"lint-staged": "^15.2.10",
8992
"lodash": "^4.17.21",
9093
"magic-string": "^0.30.12",
9194
"markdown-table": "^3.0.4",
9295
"marked": "13.0.3",
9396
"npm-run-all2": "^7.0.1",
97+
"oxc-parser": "^0.35.0",
98+
"oxc-transform": "^0.35.0",
9499
"picocolors": "^1.1.1",
95100
"prettier": "^3.3.3",
96101
"pretty-bytes": "^6.1.1",
97102
"pug": "^3.0.3",
98103
"puppeteer": "~23.3.0",
99104
"rimraf": "^6.0.1",
105+
"rolldown": "0.14.0-snapshot-d5e797b-20241114003621",
100106
"rollup": "^4.25.0",
101107
"rollup-plugin-dts": "^6.1.1",
102108
"rollup-plugin-esbuild": "^6.1.1",

packages/compiler-sfc/__tests__/parse.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ font-weight: bold;
8181

8282
const consumer = new SourceMapConsumer(script!.map!)
8383
consumer.eachMapping(mapping => {
84-
expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
84+
expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
8585
})
8686
})
8787

@@ -100,8 +100,8 @@ font-weight: bold;
100100

101101
const consumer = new SourceMapConsumer(template.map!)
102102
consumer.eachMapping(mapping => {
103-
expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
104-
expect(mapping.originalColumn - mapping.generatedColumn).toBe(2)
103+
expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
104+
expect(mapping.originalColumn! - mapping.generatedColumn).toBe(2)
105105
})
106106
})
107107

@@ -115,7 +115,7 @@ font-weight: bold;
115115

116116
const consumer = new SourceMapConsumer(custom!.map!)
117117
consumer.eachMapping(mapping => {
118-
expect(mapping.originalLine - mapping.generatedLine).toBe(padding)
118+
expect(mapping.originalLine! - mapping.generatedLine).toBe(padding)
119119
})
120120
})
121121
})

packages/compiler-sfc/src/compileTemplate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap {
289289

290290
const origPosInOldMap = oldMapConsumer.originalPositionFor({
291291
line: m.originalLine,
292-
column: m.originalColumn,
292+
column: m.originalColumn!,
293293
})
294294

295295
if (origPosInOldMap.source == null) {
@@ -305,7 +305,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap {
305305
line: origPosInOldMap.line, // map line
306306
// use current column, since the oldMap produced by @vue/compiler-sfc
307307
// does not
308-
column: m.originalColumn,
308+
column: m.originalColumn!,
309309
},
310310
source: origPosInOldMap.source,
311311
name: origPosInOldMap.name,

packages/compiler-sfc/src/script/context.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ export class ScriptCompileContext {
1818
scriptAst: Program | null
1919
scriptSetupAst: Program | null
2020

21-
source: string = this.descriptor.source
22-
filename: string = this.descriptor.filename
23-
s: MagicString = new MagicString(this.source)
24-
startOffset: number | undefined =
25-
this.descriptor.scriptSetup?.loc.start.offset
26-
endOffset: number | undefined = this.descriptor.scriptSetup?.loc.end.offset
21+
source: string
22+
filename: string
23+
s: MagicString
24+
startOffset: number | undefined
25+
endOffset: number | undefined
2726

2827
// import / type analysis
2928
scope?: TypeScope
@@ -87,6 +86,12 @@ export class ScriptCompileContext {
8786
const scriptLang = script && script.lang
8887
const scriptSetupLang = scriptSetup && scriptSetup.lang
8988

89+
this.source = descriptor.source
90+
this.filename = descriptor.filename
91+
this.s = new MagicString(descriptor.source)
92+
this.startOffset = descriptor.scriptSetup?.loc.start.offset
93+
this.endOffset = descriptor.scriptSetup?.loc.end.offset
94+
9095
this.isJS =
9196
scriptLang === 'js' ||
9297
scriptLang === 'jsx' ||
@@ -99,7 +104,7 @@ export class ScriptCompileContext {
99104
scriptSetupLang === 'tsx'
100105

101106
const customElement = options.customElement
102-
const filename = this.descriptor.filename
107+
const filename = descriptor.filename
103108
if (customElement) {
104109
this.isCE =
105110
typeof customElement === 'boolean'

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class VueElement
219219
/**
220220
* @internal
221221
*/
222-
_nonce: string | undefined = this._def.nonce
222+
_nonce: string | undefined
223223

224224
/**
225225
* @internal
@@ -253,6 +253,7 @@ export class VueElement
253253
private _createApp: CreateAppFunction<Element> = createApp,
254254
) {
255255
super()
256+
this._nonce = _def.nonce
256257
if (this.shadowRoot && _createApp !== createApp) {
257258
this._root = this.shadowRoot
258259
} else {
@@ -313,7 +314,7 @@ export class VueElement
313314
}
314315
}
315316

316-
private _setParent(parent = this._parent) {
317+
private _setParent(parent: VueElement | undefined = this._parent): void {
317318
if (parent) {
318319
this._instance!.parent = parent._instance
319320
this._instance!.provides = parent._instance!.provides

0 commit comments

Comments
 (0)