Skip to content

Commit 233df6b

Browse files
update vite
1 parent c286b76 commit 233df6b

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

packages/oc-vite/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oc-vite",
3-
"version": "4.3.9",
3+
"version": "4.4.3",
44
"type": "module",
55
"license": "MIT",
66
"author": "Evan You",
@@ -49,9 +49,9 @@
4949
"prepare": "node prepare.mjs"
5050
},
5151
"dependencies": {
52-
"esbuild": "^0.17.5",
53-
"postcss": "^8.4.23",
54-
"rollup": "^3.21.0"
52+
"esbuild": "^0.18.10",
53+
"postcss": "^8.4.25",
54+
"rollup": "^3.25.2"
5555
},
5656
"optionalDependencies": {
5757
"fsevents": "~2.3.2"
@@ -62,6 +62,7 @@
6262
"sass": "*",
6363
"stylus": "*",
6464
"sugarss": "*",
65+
"lightningcss": "^1.21.0",
6566
"terser": "^5.4.0"
6667
},
6768
"peerDependenciesMeta": {
@@ -80,6 +81,9 @@
8081
"sugarss": {
8182
"optional": true
8283
},
84+
"lightningcss": {
85+
"optional": true
86+
},
8387
"terser": {
8488
"optional": true
8589
}

packages/oc-vite/prepare.mjs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { promisify } from 'node:util';
22
import child_process from 'node:child_process';
33
import fs from 'fs';
4+
import equal from 'deep-equal';
45

56
const exec = promisify(child_process.exec);
67
const readJSON = filePath => JSON.parse(fs.readFileSync(filePath, 'utf-8'));
@@ -34,10 +35,10 @@ function checkPackages(pkgJson, vitePkgJson) {
3435
const differences = [];
3536

3637
for (const field of fields) {
37-
const pkg = JSON.stringify(pkgJson[field]);
38-
const vitePkg = JSON.stringify(vitePkgJson[field]);
38+
const pkg = pkgJson[field];
39+
const vitePkg = vitePkgJson[field];
3940

40-
if (pkg !== vitePkg) {
41+
if (!equal(pkg, vitePkg)) {
4142
differences.push({ field, differences: { pkg, vitePkg } });
4243
}
4344
}
@@ -67,6 +68,28 @@ function fixBuild(path) {
6768
fs.writeFileSync(path, fixedBuild, 'utf-8');
6869
}
6970

71+
/**
72+
* Amplify rollup to add 10 more kbs to the limit
73+
* @param {string} file
74+
*/
75+
function fixRollup(path) {
76+
const file = fs.readFileSync(path, 'utf-8');
77+
78+
const buildCondition = /bundleSizeLimit\((\d+)\)/;
79+
80+
if (!file.match(buildCondition)) {
81+
throw new Error(
82+
'Source code does not match expectations for automatic replacement of rollup limit'
83+
);
84+
}
85+
86+
const fixedBuild = file.replace(buildCondition, (match, limit) =>
87+
match.replace(limit, Number(limit) + 10)
88+
);
89+
90+
fs.writeFileSync(path, fixedBuild, 'utf-8');
91+
}
92+
7093
async function main() {
7194
rmDir('./bin');
7295
rmDir('./dist');
@@ -88,6 +111,7 @@ async function main() {
88111

89112
console.log('Building');
90113
fixBuild('./vite/packages/vite/src/node/plugins/asset.ts');
114+
fixRollup('./vite/packages/vite/rollup.config.ts');
91115
await exec('pnpm build', { cwd: './vite/packages/vite' });
92116

93117
console.log('Moving folders');

0 commit comments

Comments
 (0)