Skip to content
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

chore(draft): switch to Rolldown #11

Closed
wants to merge 8 commits into from
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
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,18 @@
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
"changeset:release": "changeset publish",
"dev": "rollup --config --watch",
"build": "pnpm -r build && rollup -c",
"build": "rolldown -c",
"test": "pnpm -r test"
},
"devDependencies": {
"@changesets/cli": "^2.27.6",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@sveltejs/eslint-config": "^8.0.1",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"@types/node": "^22.3.0",
"eslint": "^9.6.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.2.6",
"rollup": "^4.20.0",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-preserve-shebangs": "^0.2.0",
"rolldown": "0.12.2",
"typescript": "^5.3.3",
"typescript-eslint": "^8.0.0",
"unplugin-isolated-decl": "^0.4.5"
Expand Down
8 changes: 3 additions & 5 deletions packages/adders/drizzle/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
4 changes: 2 additions & 2 deletions packages/adders/eslint/config/adder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'node:fs';
import path from 'node:path';
import { defineAdderConfig, log } from '@svelte-cli/core';
import { options } from './options.js';
import { addEslintConfigPrettier } from '../../common.js';
import { options } from './options';
import { addEslintConfigPrettier } from '../../common';

export const adder = defineAdderConfig({
metadata: {
Expand Down
8 changes: 3 additions & 5 deletions packages/adders/eslint/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
54 changes: 36 additions & 18 deletions packages/adders/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
import type { AdderConfig, AdderWithoutExplicitArgs, Question } from '@svelte-cli/core';
import type { AdderWithoutExplicitArgs } from '@svelte-cli/core';

export async function getAdderDetails(name: string) {
const adder: { default: AdderWithoutExplicitArgs } = await import(`./${name}/index.ts`);
// Rolldown doesn't support dynamic import vars yet.
export async function getAdderDetails(name: string): Promise<AdderWithoutExplicitArgs> {
let adder;
switch (name) {
case 'drizzle':
adder = await import('./drizzle/index');
break;
case 'eslint':
adder = await import('./eslint/index');
break;
case 'mdsvex':
adder = await import('./mdsvex/index');
break;
case 'playwright':
adder = await import('./playwright/index');
break;
case 'prettier':
adder = await import('./prettier/index');
break;
case 'routify':
adder = await import('./routify/index');
break;
case 'storybook':
adder = await import('./storybook/index');
break;
case 'tailwindcss':
adder = await import('./tailwindcss/index');
break;
case 'vitest':
adder = await import('./vitest/index');
break;
default:
throw new Error(`invalid adder name: ${name}`);
}

return adder.default;
}

export async function getAdderConfig(name: string) {
// Mainly used by the website
// Either vite / rollup or esbuild are not able to process the shebangs
// present on the `index.js` file. That's why we directly import the configuration
// for the website here, as this is the only important part.

const adder: Promise<{ adder: AdderConfig<Record<string, Question>> }> = await import(
`./${name}/config/adder.ts`
);
const { adder: adderConfig } = await adder;

return adderConfig;
return adder.default as AdderWithoutExplicitArgs;
}
8 changes: 3 additions & 5 deletions packages/adders/mdsvex/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { tests } from './config/tests.js';
import { checks } from './config/checks.js';
import { adder } from './config/adder';
import { tests } from './config/tests';
import { checks } from './config/checks';

export default defineAdder(adder, checks, tests);
2 changes: 1 addition & 1 deletion packages/adders/playwright/config/adder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import { join } from 'node:path';
import { dedent, defineAdderConfig, log } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const adder = defineAdderConfig({
metadata: {
Expand Down
2 changes: 1 addition & 1 deletion packages/adders/playwright/config/checks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderChecks } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const checks = defineAdderChecks({
options
Expand Down
2 changes: 1 addition & 1 deletion packages/adders/playwright/config/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderTests } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const tests = defineAdderTests({
files: [],
Expand Down
8 changes: 3 additions & 5 deletions packages/adders/playwright/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
4 changes: 2 additions & 2 deletions packages/adders/prettier/config/adder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dedent, defineAdderConfig, log, colors } from '@svelte-cli/core';
import { options } from './options.js';
import { addEslintConfigPrettier } from '../../common.js';
import { options } from './options';
import { addEslintConfigPrettier } from '../../common';

export const adder = defineAdderConfig({
metadata: {
Expand Down
8 changes: 3 additions & 5 deletions packages/adders/prettier/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
8 changes: 3 additions & 5 deletions packages/adders/routify/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { tests } from './config/tests.js';
import { checks } from './config/checks.js';
import { adder } from './config/adder';
import { tests } from './config/tests';
import { checks } from './config/checks';

export default defineAdder(adder, checks, tests);
2 changes: 1 addition & 1 deletion packages/adders/storybook/config/adder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderConfig } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const adder = defineAdderConfig({
metadata: {
Expand Down
2 changes: 1 addition & 1 deletion packages/adders/storybook/config/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderTests } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

let port = 6006;

Expand Down
8 changes: 3 additions & 5 deletions packages/adders/storybook/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { tests } from './config/tests.js';
import { checks } from './config/checks.js';
import { adder } from './config/adder';
import { tests } from './config/tests';
import { checks } from './config/checks';

export default defineAdder(adder, checks, tests);
8 changes: 3 additions & 5 deletions packages/adders/tailwindcss/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
2 changes: 1 addition & 1 deletion packages/adders/vitest/config/adder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dedent, defineAdderConfig, log } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const adder = defineAdderConfig({
metadata: {
Expand Down
2 changes: 1 addition & 1 deletion packages/adders/vitest/config/checks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderChecks } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const checks = defineAdderChecks({
options
Expand Down
2 changes: 1 addition & 1 deletion packages/adders/vitest/config/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineAdderTests } from '@svelte-cli/core';
import { options } from './options.js';
import { options } from './options';

export const tests = defineAdderTests({
files: [],
Expand Down
8 changes: 3 additions & 5 deletions packages/adders/vitest/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env node

import { defineAdder } from '@svelte-cli/core';
import { adder } from './config/adder.js';
import { checks } from './config/checks.js';
import { tests } from './config/tests.js';
import { adder } from './config/adder';
import { checks } from './config/checks';
import { tests } from './config/tests';

export default defineAdder(adder, checks, tests);
6 changes: 3 additions & 3 deletions packages/clack-core/src/prompts/password.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import color from 'picocolors';
import pc from 'picocolors';
import Prompt, { type PromptOptions } from './prompt';

interface PasswordOptions extends PromptOptions<PasswordPrompt> {
Expand All @@ -22,11 +22,11 @@ export default class PasswordPrompt extends Prompt {
});
this.on('value', () => {
if (this.cursor >= this.value.length) {
this.valueWithCursor = `${this.masked}${color.inverse(color.hidden('_'))}`;
this.valueWithCursor = `${this.masked}${pc.inverse(pc.hidden('_'))}`;
} else {
const s1 = this.masked.slice(0, this.cursor);
const s2 = this.masked.slice(this.cursor);
this.valueWithCursor = `${s1}${color.inverse(s2[0])}${s2.slice(1)}`;
this.valueWithCursor = `${s1}${pc.inverse(s2[0])}${s2.slice(1)}`;
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions packages/clack-core/src/prompts/text.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import color from 'picocolors';
import pc from 'picocolors';
import Prompt, { type PromptOptions } from './prompt';

export interface TextOptions extends PromptOptions<TextPrompt> {
Expand All @@ -22,11 +22,11 @@ export default class TextPrompt extends Prompt {
});
this.on('value', () => {
if (this.cursor >= this.value.length) {
this.valueWithCursor = `${this.value}${color.inverse(color.hidden('_'))}`;
this.valueWithCursor = `${this.value}${pc.inverse(pc.hidden('_'))}`;
} else {
const s1 = this.value.slice(0, this.cursor);
const s2 = this.value.slice(this.cursor);
this.valueWithCursor = `${s1}${color.inverse(s2[0])}${s2.slice(1)}`;
this.valueWithCursor = `${s1}${pc.inverse(s2[0])}${s2.slice(1)}`;
}
});
}
Expand Down
Loading