Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"vite",
"vitest",
"vitest-dev",
"yuku-parser"
"yuku"
],
"enabled": false
},
Expand Down Expand Up @@ -163,8 +163,7 @@
"anyhow",
"append-only-vec",
"arcstr",
"async-channel",
"async-scoped",
"async-lock",
"base-encode",
"base64-simd",
"bitflags",
Expand All @@ -173,13 +172,15 @@
"dashmap",
"derive_more",
"dunce",
"event-listener",
"fast-glob",
"flate2",
"form_urlencoded",
"futures",
"glob",
"globstar",
"heck",
"idna",
"idna_adapter",
"indexmap",
"infer",
Expand Down Expand Up @@ -212,6 +213,7 @@
"rolldown-ariadne",
"rolldown-notify",
"rolldown-notify-debouncer-full",
"rolldown-notify-napi",
"rustc-hash",
"schemars",
"self_cell",
Expand Down
22 changes: 22 additions & 0 deletions .github/scripts/__tests__/upgrade-deps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,28 @@ test('pins the bundled parser, syncs Vite ranges, and preserves upgrade metadata
expect(readFileSync(corePath, 'utf8')).toBe(before);
});

test('migrates the external parser to consolidated Yuku', () => {
const fixture = createSyncFixture();
const plugin = readJson(fixture.pluginPath);
plugin.dependencies = { yuku: '^0.28.0' };
writeJson(fixture.pluginPath, plugin);
writeJson(join(dirname(fixture.pluginPath), 'node_modules/yuku/package.json'), {
version: '0.28.1',
});

fixture.run();
expect(readJson(fixture.corePath).dependencies).toEqual({
postcss: '^8.5.28',
yuku: '0.28.1',
});
expect(readJson(fixture.versionsPath)['yuku']).toEqual({ old: '^0.9.3', new: '0.28.1' });
expect(readJson(fixture.versionsPath)).not.toHaveProperty('yuku-parser');

const before = readFileSync(fixture.corePath, 'utf8');
fixture.run();
expect(readFileSync(fixture.corePath, 'utf8')).toBe(before);
});

test('restarts the core version counter when the bundled Vite changes', () => {
const fixture = createSyncFixture();
const { corePath, versionsPath, metaDir, run } = fixture;
Expand Down
13 changes: 9 additions & 4 deletions .github/scripts/upgrade-deps-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ export function getBundledDependencyRanges(
const tsdownRequire = createRequire(coreRequire.resolve('tsdown/package.json'));
const pluginPath = tsdownRequire.resolve('rolldown-plugin-dts/package.json');
const vitePath = join(root, 'vite/packages/vite/package.json');
const pluginDependencies = readJsonObject(pluginPath).dependencies;
const yukuName =
isObjectValue(pluginDependencies) && Object.hasOwn(pluginDependencies, 'yuku')
? 'yuku'
: 'yuku-parser';
// These packages stay external in packages/core/build.ts. Follow their
// bundled consumers rather than independently selecting the latest releases.
const sources: Array<{ path: string; field: DependencyField; name: string }> = [
{ path: pluginPath, field: 'dependencies', name: 'yuku-parser' },
{ path: pluginPath, field: 'dependencies', name: yukuName },
{ path: vitePath, field: 'dependencies', name: 'postcss' },
{ path: vitePath, field: 'optionalDependencies', name: 'fsevents' },
];
Expand All @@ -28,9 +33,9 @@ export function getBundledDependencyRanges(
if (typeof range !== 'string' || range.trim() === '') {
throw new Error(`Missing ${field}.${name} in ${path}; review core's externals`);
}
if (name === 'yuku-parser') {
// Pin the runtime parser to the exact version resolved by the bundled plugin.
const parserPath = createRequire(path).resolve('yuku-parser/package.json');
if (name === 'yuku' || name === 'yuku-parser') {
// Pin the runtime package to the exact version resolved by the bundled plugin.
const parserPath = createRequire(path).resolve(`${name}/package.json`);
const { version } = readJsonObject(parserPath);
if (typeof version !== 'string' || version.trim() === '') {
throw new Error(`Missing version in ${parserPath}; review core's externals`);
Expand Down
13 changes: 11 additions & 2 deletions .github/scripts/upgrade-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,20 @@ function syncBundledDependencies(): void {
const pkg = readJsonObject(filePath);
for (const { name, field, range } of ranges) {
const dependencies = pkg[field];
if (!isObjectValue(dependencies) || typeof dependencies[name] !== 'string') {
if (!isObjectValue(dependencies)) {
throw new Error(`Missing ${field} in ${filePath}`);
}
// rolldown-plugin-dts 0.30 consolidated its parser packages into `yuku`.
const previousName =
name === 'yuku' && typeof dependencies[name] !== 'string' ? 'yuku-parser' : name;
if (typeof dependencies[previousName] !== 'string') {
throw new Error(`Missing ${field}.${name} in ${filePath}`);
}
// Preserve the original version if synchronization runs again after fixups.
recordChange(name, changes.get(name)?.old ?? dependencies[name], range);
recordChange(name, changes.get(name)?.old ?? dependencies[previousName], range);
if (previousName !== name) {
delete dependencies[previousName];
}
dependencies[name] = range;
}
syncCoreVersion(pkg);
Expand Down
Loading
Loading