Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 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
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ jobs:

- name: Run CLI lint
run: pnpm lint
if: ${{ matrix.os != 'windows-latest' }}

- name: Install Playwright browsers
run: pnpx playwright install chromium
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:

permissions: {}

env:
RELEASE_BUILD: 'true'

jobs:
build-rust:
runs-on: ${{ matrix.settings.os }}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vite-plus-monorepo",
"license": "BUSL-1.1",
"private": true,
"packageManager": "pnpm@10.19.0",
"packageManager": "pnpm@10.22.0",
Comment thread
Brooooooklyn marked this conversation as resolved.
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
Expand All @@ -12,7 +12,7 @@
"bootstrap-cli:ci": "pnpm --filter=@voidzero-dev/global build && pnpm install-global-cli",
"install-global-cli": "npm install -g ./packages/global",
"typecheck": "tsc -b tsconfig.json",
"lint": "vite lint",
"lint": "vite lint --type-aware --threads 4",
Comment thread
fengmk2 marked this conversation as resolved.
"test": "vite test run --config vite.config.ts && pnpm -r snap-test",
"prepare": "husky"
},
Expand Down
33 changes: 24 additions & 9 deletions packages/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import pkgJson from './package.json' with { type: 'json' };
import viteRolldownConfig from './vite-rolldown.config';

const projectDir = join(fileURLToPath(import.meta.url), '..');
const rolldownViteSourceDir = resolve(projectDir, '..', '..', 'rolldown-vite', 'packages', 'vite');

// Main build orchestration
await buildCli();
Expand Down Expand Up @@ -45,8 +46,8 @@ async function buildNapiBinding() {

async function buildCli() {
await build({
input: ['./src/bin.ts', './src/index.ts', './src/test.ts'],
external: [/^node:/, 'vitest'],
input: ['./src/bin.ts', './src/index.ts', './src/config.ts'],
external: [/^node:/, 'vitest-dev', './vitest/dist/config.js', './vitest/dist/index.js'],
plugins: [
{
name: 'rewrite-import-path',
Expand All @@ -55,7 +56,7 @@ async function buildCli() {
const { magicString } = meta;
if (moduleInfo?.isEntry && magicString) {
magicString.replaceAll(`'vite'`, `'${pkgJson.name}/vite'`);
magicString.replaceAll(`export * from 'vitest';`, `export * from '${pkgJson.name}/vitest';`);
magicString.replaceAll(`export * from 'vitest-dev';`, `export * from './vitest/dist/index.js';`);
return {
code: magicString,
};
Expand All @@ -66,6 +67,15 @@ async function buildCli() {
return { id, external: true };
}
},
renderChunk(code) {
if (code.includes('import * as Rolldown from "rolldown"')) {
return code.replaceAll(
`import * as Rolldown from "rolldown"`,
`import * as Rolldown from "${pkgJson.name}/rolldown"`,
);
}
return code;
Comment thread
Brooooooklyn marked this conversation as resolved.
},
Comment thread
Brooooooklyn marked this conversation as resolved.
},
dts(),
],
Expand All @@ -77,6 +87,8 @@ async function buildCli() {
nativeMagicString: true,
},
});

await cp(join(rolldownViteSourceDir, 'client.d.ts'), join(projectDir, 'dist', 'vite', 'client.d.ts'));
}

async function buildVite() {
Expand Down Expand Up @@ -179,7 +191,6 @@ async function buildVite() {
await build(newViteRolldownConfig as BuildOptions[]);

// Copy additional vite files
const rolldownViteSourceDir = resolve(projectDir, '..', '..', 'rolldown-vite', 'packages', 'vite');

await cp(join(rolldownViteSourceDir, 'misc'), join(projectDir, 'dist/vite/misc'), {
recursive: true,
Expand Down Expand Up @@ -255,9 +266,13 @@ async function bundleRolldown() {

// Rewrite @rolldown/pluginutils imports
for (const file of rolldownFiles) {
const source = await readFile(file, 'utf-8');
if (source.includes('"@rolldown/pluginutils"')) {
await writeFile(file, source.replaceAll('"@rolldown/pluginutils"', `"${pkgJson.name}/rolldown/pluginutils"`));
if (file.endsWith('.mjs') || file.endsWith('.js')) {
Comment thread
Brooooooklyn marked this conversation as resolved.
const source = await readFile(file, 'utf-8');
let newSource = source.replaceAll('"@rolldown/pluginutils"', `"${pkgJson.name}/rolldown/pluginutils"`);
if (process.env.RELEASE_BUILD) {
newSource = newSource.replaceAll(`__require("../rolldown-binding`, `__require("./rolldown-binding`);
}
await writeFile(file, newSource);
}
}
}
Expand Down Expand Up @@ -349,7 +364,7 @@ async function bundleVitepress() {
}

async function bundleVitest() {
const vitestSourceDir = resolve(projectDir, 'node_modules/vitest');
const vitestSourceDir = resolve(projectDir, 'node_modules/vitest-dev');
const vitestDestDir = join(projectDir, 'dist/vitest');

await mkdir(vitestDestDir, { recursive: true });
Expand Down Expand Up @@ -384,7 +399,7 @@ async function bundleVitest() {
).replaceAll(`import 'vite';`, `import '${pkgJson.name}/vite';`).replaceAll(
`'vite/module-runner'`,
`'${pkgJson.name}/module-runner'`,
);
).replaceAll(`declare module "vite"`, `declare module "${pkgJson.name}/vite"`);
await writeFile(destPath, content, 'utf-8');
} else {
await copyFile(file, destPath);
Expand Down
91 changes: 31 additions & 60 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
"default": "./dist/vitest/browser/context.js"
},
"./client": {
"types": "./dist/client.d.ts"
"types": "./dist/vite/client.d.ts"
},
"./config": {
"types": "./dist/vitest/config.d.ts",
"require": "./dist/vitest/dist/config.cjs",
"default": "./dist/vitest/dist/config.js"
"types": "./dist/config.d.ts",
"default": "./dist/config.js"
},
"./coverage": {
"types": "./dist/vitest/coverage.d.ts",
Expand Down Expand Up @@ -105,6 +104,10 @@
"default": "./dist/rolldown/parse-ast-index.mjs",
"types": "./dist/rolldown/parse-ast-index.d.mts"
},
"./rolldown/plugins": {
"default": "./dist/rolldown/plugins-index.mjs",
"types": "./dist/rolldown/plugins-index.d.mts"
},
"./rolldown/pluginutils": {
"default": "./dist/pluginutils/index.js",
"types": "./dist/pluginutils/index.d.ts"
Expand All @@ -122,10 +125,6 @@
"types": "./dist/vitest/dist/suite.d.ts",
"default": "./dist/vitest/dist/suite.js"
},
"./test": {
"import": "./dist/test.js",
"types": "./dist/test.d.ts"
},
"./tsdown/run": {
"default": "./dist/tsdown/run.js"
},
Expand Down Expand Up @@ -189,32 +188,15 @@
"dist"
],
"dependencies": {
"@oxc-project/types": "=0.96.0",
"debug": "^4.4.3",
"oxfmt": "^0.9.0",
"oxlint": "^1.25.0",
"oxlint-tsgolint": "^0.4.0",
"@oxc-project/types": "catalog:",
"debug": "catalog:",
"oxfmt": "catalog:",
"oxlint": "catalog:",
"oxlint-tsgolint": "catalog:",
"postcss": "^8.5.6",
"lightningcss": "^1.30.2",
"semver": "^7.7.3",
"tree-kill": "^1.2.2",
"@docsearch/css": "^4.0.0-beta.7",
"@docsearch/js": "^4.0.0-beta.7",
"@iconify-json/simple-icons": "^1.2.47",
"@shikijs/core": "^3.9.2",
"@shikijs/transformers": "^3.9.2",
"@shikijs/types": "^3.9.2",
"@types/markdown-it": "^14.1.2",
"@vitejs/plugin-vue": "^6.0.1",
"@vue/devtools-api": "^8.0.0",
"@vue/shared": "^3.5.18",
"@vueuse/core": "^13.6.0",
"@vueuse/integrations": "^13.6.0",
"focus-trap": "^7.6.5",
"mark.js": "8.11.1",
"minisearch": "^7.1.2",
"shiki": "^3.9.2",
"vue": "^3.5.18",
"es-module-lexer": "^1.7.0",
"expect-type": "^1.2.2",
"magic-string": "^0.30.19",
Expand All @@ -225,33 +207,30 @@
"tinyexec": "^0.3.2",
"tinyglobby": "^0.2.15",
"tinyrainbow": "^3.0.3",
"vite": "^6.0.0 || ^7.0.0",
"why-is-node-running": "^2.3.0",
"@vitest/expect": "4.0.6",
"@vitest/pretty-format": "4.0.6",
"@vitest/runner": "4.0.6",
"@vitest/mocker": "4.0.6",
"@vitest/utils": "4.0.6",
"@vitest/spy": "4.0.6",
"@vitest/snapshot": "4.0.6"
"@vitest/expect": "4.0.10",
"@vitest/pretty-format": "4.0.10",
"@vitest/runner": "4.0.10",
"@vitest/mocker": "4.0.10",
"@vitest/utils": "4.0.10",
"@vitest/spy": "4.0.10",
"@vitest/snapshot": "4.0.10"
Comment thread
Brooooooklyn marked this conversation as resolved.
},
"peerDependencies": {
"@arethetypeswrong/core": "^0.18.1",
"@edge-runtime/vm": "*",
"@types/debug": "^4.1.12",
"@types/node": "^20.19.0 || >=22.12.0",
"@vitest/browser-playwright": "4.0.6",
"@vitest/browser-preview": "4.0.6",
"@vitest/browser-webdriverio": "4.0.6",
"@vitest/ui": "4.0.6",
"@vitejs/devtools": "^0.0.0-alpha.10",
"@vitest/browser-playwright": "4.0.10",
"@vitest/browser-preview": "4.0.10",
"@vitest/browser-webdriverio": "4.0.10",
"@vitest/ui": "4.0.10",
Comment thread
Brooooooklyn marked this conversation as resolved.
"esbuild": "^0.25.0",
Comment thread
Brooooooklyn marked this conversation as resolved.
Comment thread
Brooooooklyn marked this conversation as resolved.
"happy-dom": "*",
"jiti": ">=1.21.0",
"jsdom": "*",
"less": "^4.0.0",
"markdown-it-mathjax3": "^4",
"oxc-minify": "^0.96.0",
"postcss": "^8",
"publint": "^0.3.0",
"sass": "^1.70.0",
"sass-embedded": "^1.70.0",
Expand All @@ -278,6 +257,9 @@
"@types/node": {
"optional": true
},
"@vitejs/devtools": {
"optional": true
},
"@vitest/browser-playwright": {
"optional": true
},
Expand Down Expand Up @@ -305,15 +287,6 @@
"less": {
"optional": true
},
"markdown-it-mathjax3": {
"optional": true
},
"oxc-minify": {
"optional": true
},
"postcss": {
"optional": true
},
"publint": {
"optional": true
},
Expand Down Expand Up @@ -355,9 +328,8 @@
"@babel/parser": "^7.28.4",
"@napi-rs/cli": "^3.4.1",
"@oxc-node/core": "^0.0.32",
"@oxc-project/types": "=0.96.0",
"@vitest/browser": "^4.0.6",
"@vitest/browser-playwright": "^4.0.6",
"@vitest/browser": "^4.0.10",
"@vitest/browser-playwright": "^4.0.10",
"@voidzero-dev/vite-plus-tools": "workspace:",
"es-module-lexer": "^1.7.0",
"estree-walker": "^3.0.3",
Expand All @@ -371,9 +343,8 @@
"rollup-plugin-license": "^3.6.0",
"tinyglobby": "^0.2.15",
"tsdown": "0.16.0",
"rolldown-vite": "^7.1.19",
"vitepress": "2.0.0-alpha.12",
"vitest": "^4.0.6"
"rolldown-vite": "workspace:*",
"vitest-dev": "^4.0.10"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/snap-tests/command-doc/steps.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ignoredPlatforms": ["win32"],
"ignoredPlatforms": ["win32", "darwin", "linux"],
Comment thread
Brooooooklyn marked this conversation as resolved.
"env": {
"VITE_DISABLE_AUTO_INSTALL": "1"
},
Expand Down
Loading
Loading