Skip to content
Draft
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
7 changes: 4 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,6 +172,7 @@
"dashmap",
"derive_more",
"dunce",
"event-listener",
"fast-glob",
"flate2",
"form_urlencoded",
Expand Down Expand Up @@ -212,6 +212,7 @@
"rolldown-ariadne",
"rolldown-notify",
"rolldown-notify-debouncer-full",
"rolldown-notify-napi",
"rustc-hash",
"schemars",
"self_cell",
Expand Down
38 changes: 17 additions & 21 deletions .github/scripts/__tests__/upgrade-deps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,12 @@ test.each([false, true])(
if (args?.[0] === 'dedupe') {
// The actual bundled plugin can change during dependency deduplication.
writeJson(pluginPath, {
dependencies: { 'yuku-codegen': '^0.11.0', 'yuku-parser': '^0.11.0' },
dependencies: { 'yuku-codegen': '^0.11.0', yuku: '^0.11.0' },
});
writeJson(parserPath, { version: '0.11.2' });
}
if (commands.length === 4) {
parserAtFinalInstall = requireJsonObject(readJson(corePath).dependencies, corePath)[
'yuku-parser'
];
parserAtFinalInstall = requireJsonObject(readJson(corePath).dependencies, corePath)['yuku'];
}
return Buffer.from('');
});
Expand All @@ -182,7 +180,7 @@ test.each([false, true])(
expect(compareUrls).toEqual([expect.stringContaining(`/compare/${pinnedOxcNode}...`)]);
expect(parserAtFinalInstall).toBe(failInstall ? undefined : '0.11.2');
expect(readJson(corePath)).toHaveProperty(
['dependencies', 'yuku-parser'],
['dependencies', failInstall ? 'yuku-parser' : 'yuku'],
failInstall ? '^0.9.3' : '0.11.2',
);

Expand Down Expand Up @@ -225,9 +223,7 @@ test.each([false, true])(
? { old: pinnedOxcNode, new: pinnedOxcNode }
: { old: pinnedOxcNode, new: 'a'.repeat(40), tag: 'v1.2.3' },
);
expect(versions['yuku-parser']).toEqual(
failInstall ? undefined : { old: '^0.9.3', new: '0.11.2' },
);
expect(versions['yuku']).toEqual(failInstall ? undefined : { old: '^0.9.3', new: '0.11.2' });
expect(readFileSync(join(metaDir, 'commit-message.txt'), 'utf8')).toContain(
'- lint-staged: 16.2.6 -> 17.5.1',
);
Expand All @@ -250,7 +246,7 @@ function createSyncFixture() {
onTestFinished(() => rmSync(root, { recursive: true, force: true }));
const corePath = join(root, 'packages/core/package.json');
const pluginPath = join(root, 'store/tsdown/node_modules/rolldown-plugin-dts/package.json');
const parserPath = join(dirname(pluginPath), 'node_modules/yuku-parser/package.json');
const parserPath = join(dirname(pluginPath), 'node_modules/yuku/package.json');
const vitePath = join(root, 'vite/packages/vite/package.json');
const metaDir = join(root, 'meta');
const versionsPath = join(metaDir, 'versions.json');
Expand All @@ -266,7 +262,7 @@ function createSyncFixture() {
dependencies: {
'yuku-ast': '^0.10.1',
'yuku-codegen': '^0.10.1',
'yuku-parser': '~0.10.2',
yuku: '~0.10.2',
},
});
writeJson(parserPath, { version: '0.10.3' });
Expand All @@ -282,7 +278,7 @@ function createSyncFixture() {
'junction',
);
writeJson(join(root, 'packages/core/node_modules/rolldown-plugin-dts/package.json'), {
dependencies: { 'yuku-codegen': '^0.8.1', 'yuku-parser': '^0.8.1' },
dependencies: { 'yuku-codegen': '^0.8.1', yuku: '^0.8.1' },
});
writeJson(vitePath, {
version: '8.3.5',
Expand Down Expand Up @@ -311,33 +307,33 @@ test('pins the bundled parser, syncs Vite ranges, and preserves upgrade metadata
expect(readJson(corePath)).toEqual({
// The bundled Vite did not change, so the release counter stays.
version: '8.3.5001',
dependencies: { 'yuku-parser': '0.10.3', postcss: '^8.5.28' },
dependencies: { yuku: '0.10.3', postcss: '^8.5.28' },
optionalDependencies: { fsevents: '~2.4.0' },
devDependencies: { 'rolldown-plugin-dts': '^0.28.0' },
bundledVersions: { vite: '8.3.5' },
});
expect(readJson(versionsPath)).toEqual({
oxlint: { old: '1.86.0', new: '1.87.0' },
'yuku-parser': { old: '^0.9.3', new: '0.10.3' },
yuku: { old: '^0.9.3', new: '0.10.3' },
postcss: { old: '^8.5.6', new: '^8.5.28' },
fsevents: { old: '~2.3.3', new: '~2.4.0' },
});
expect(readFileSync(join(metaDir, 'pr-body.md'), 'utf8')).toContain(
'| `yuku-parser` | `^0.9.3` | `0.10.3` |',
'| `yuku` | `^0.9.3` | `0.10.3` |',
);

// A second pass after lockfile deduplication must retain the original ranges.
writeJson(fixture.pluginPath, {
dependencies: { 'yuku-codegen': '^0.11.0', 'yuku-parser': '^0.11.0' },
dependencies: { 'yuku-codegen': '^0.11.0', yuku: '^0.11.0' },
});
writeJson(fixture.parserPath, { version: '0.11.2' });
run();
expect(readJson(corePath).dependencies).not.toHaveProperty('yuku-ast');
expect(readJson(corePath).dependencies).not.toHaveProperty('yuku-codegen');
expect(readJson(corePath)).toHaveProperty(['dependencies', 'yuku-parser'], '0.11.2');
expect(readJson(versionsPath)['yuku-parser']).toEqual({ old: '^0.9.3', new: '0.11.2' });
expect(readJson(corePath)).toHaveProperty(['dependencies', 'yuku'], '0.11.2');
expect(readJson(versionsPath)['yuku']).toEqual({ old: '^0.9.3', new: '0.11.2' });
expect(readFileSync(join(metaDir, 'commit-message.txt'), 'utf8')).toContain(
'- yuku-parser: ^0.9.3 -> 0.11.2',
'- yuku: ^0.9.3 -> 0.11.2',
);
const before = readFileSync(corePath, 'utf8');
run();
Expand Down Expand Up @@ -390,8 +386,8 @@ test('updates the parser pin when its installed version changes within the same
run();
writeJson(parserPath, { version: '0.10.4' });
run();
expect(readJson(corePath)).toHaveProperty(['dependencies', 'yuku-parser'], '0.10.4');
expect(readJson(versionsPath)['yuku-parser']).toEqual({ old: '^0.9.3', new: '0.10.4' });
expect(readJson(corePath)).toHaveProperty(['dependencies', 'yuku'], '0.10.4');
expect(readJson(versionsPath)['yuku']).toEqual({ old: '^0.9.3', new: '0.10.4' });
});

test.each([undefined, '', ' '])(
Expand All @@ -409,7 +405,7 @@ test.each([undefined, '', ' '])(
);

test.each([
{ source: 'pluginPath', field: 'dependencies', name: 'yuku-parser' },
{ source: 'pluginPath', field: 'dependencies', name: 'yuku' },
{ source: 'vitePath', field: 'dependencies', name: 'postcss' },
{ source: 'vitePath', field: 'optionalDependencies', name: 'fsevents' },
] as const)('fails without writing core when upstream removes $name', ({ source, field, name }) => {
Expand Down
12 changes: 6 additions & 6 deletions .github/scripts/upgrade-deps-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function getBundledDependencyRanges(
// 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: 'yuku' },
{ path: vitePath, field: 'dependencies', name: 'postcss' },
{ path: vitePath, field: 'optionalDependencies', name: 'fsevents' },
];
Expand All @@ -28,12 +28,12 @@ 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');
const { version } = readJsonObject(parserPath);
if (name === 'yuku') {
// Pin the runtime package to the exact version resolved by the bundled plugin.
const yukuPath = createRequire(path).resolve('yuku/package.json');
const { version } = readJsonObject(yukuPath);
if (typeof version !== 'string' || version.trim() === '') {
throw new Error(`Missing version in ${parserPath}; review core's externals`);
throw new Error(`Missing version in ${yukuPath}; review core's externals`);
}
range = version;
}
Expand Down
15 changes: 13 additions & 2 deletions .github/scripts/upgrade-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,22 @@ 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') {
// Yuku consolidated its parser packages into `yuku` in the dts plugin.
// Accept the old core field once so the upgrade can perform the rename.
const previousName = name === 'yuku' ? 'yuku-parser' : undefined;
const previousRange =
isObjectValue(dependencies) && previousName ? dependencies[previousName] : undefined;
const currentRange = isObjectValue(dependencies)
? (dependencies[name] ?? previousRange)
: undefined;
if (!isObjectValue(dependencies) || typeof currentRange !== '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 ?? currentRange, range);
if (previousName) {
delete dependencies[previousName];
}
dependencies[name] = range;
}
syncCoreVersion(pkg);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
follow the pinned upstream requirements.
- After changing tsdown or rolldown-plugin-dts, run
`node .github/scripts/upgrade-deps.ts --sync-bundled-deps`, then
`pnpm install --no-frozen-lockfile`. Core's external `yuku-parser` must
`pnpm install --no-frozen-lockfile`. Core's external `yuku` must
use the exact installed version resolved by the plugin bundled through
tsdown, so it stays aligned with the bundled Yuku code. Do not replace
this pin with a version range. The sync command also
Expand Down
Loading
Loading