Skip to content

Commit a50d10c

Browse files
merceyzarcanis
andauthored
perf: reduce bundle size (#4315)
Co-authored-by: Maël Nison <[email protected]>
1 parent 39f6b0f commit a50d10c

File tree

7 files changed

+162
-55
lines changed

7 files changed

+162
-55
lines changed

.pnp.cjs

Lines changed: 53 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
114 KB
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/build/ink.js b/build/ink.js
2+
index f292bccdd049835ded848da83a6daac1e4f70416..54c4ebf36dc0c8f7f2580a5e69869848c83dc46f 100644
3+
--- a/build/ink.js
4+
+++ b/build/ink.js
5+
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6+
};
7+
Object.defineProperty(exports, "__esModule", { value: true });
8+
const react_1 = __importDefault(require("react"));
9+
-const lodash_1 = require("lodash");
10+
+const lodash_1_throttle = require("lodash/throttle");
11+
const log_update_1 = __importDefault(require("./log-update"));
12+
const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
13+
const is_ci_1 = __importDefault(require("is-ci"));
14+
@@ -90,7 +90,7 @@ class Ink {
15+
this.rootNode = dom.createNode('ink-root');
16+
this.rootNode.onRender = options.debug
17+
? this.onRender
18+
- : lodash_1.throttle(this.onRender, 32, {
19+
+ : lodash_1_throttle(this.onRender, 32, {
20+
leading: true,
21+
trailing: true
22+
});
23+
@@ -98,7 +98,7 @@ class Ink {
24+
this.log = log_update_1.default.create(options.stdout);
25+
this.throttledLog = options.debug
26+
? this.log
27+
- : lodash_1.throttle(this.log, undefined, {
28+
+ : lodash_1_throttle(this.log, undefined, {
29+
leading: true,
30+
trailing: true
31+
});

.yarn/versions/4bdc9471.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
releases:
2+
"@yarnpkg/builder": patch
3+
"@yarnpkg/cli": patch
4+
5+
declined:
6+
- "@yarnpkg/plugin-compat"
7+
- "@yarnpkg/plugin-constraints"
8+
- "@yarnpkg/plugin-dlx"
9+
- "@yarnpkg/plugin-essentials"
10+
- "@yarnpkg/plugin-exec"
11+
- "@yarnpkg/plugin-init"
12+
- "@yarnpkg/plugin-interactive-tools"
13+
- "@yarnpkg/plugin-nm"
14+
- "@yarnpkg/plugin-npm-cli"
15+
- "@yarnpkg/plugin-pack"
16+
- "@yarnpkg/plugin-patch"
17+
- "@yarnpkg/plugin-pnp"
18+
- "@yarnpkg/plugin-pnpm"
19+
- "@yarnpkg/plugin-stage"
20+
- "@yarnpkg/plugin-typescript"
21+
- "@yarnpkg/plugin-version"
22+
- "@yarnpkg/plugin-workspace-tools"
23+
- "@yarnpkg/core"
24+
- "@yarnpkg/doctor"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"typescript": "4.6.1-rc"
2727
},
2828
"resolutions": {
29+
"ink": "patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch",
2930
"yoga-layout-prebuilt": "patch:[email protected]#./.yarn/patches/yoga-layout-prebuilt.patch"
3031
},
3132
"dependenciesMeta": {

packages/yarnpkg-builder/sources/commands/build/bundle.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,21 @@ export default class BuildBundleCommand extends Command {
120120
},
121121
entryPoints: [path.join(basedir, `sources/cli.ts`)],
122122
bundle: true,
123-
define: {YARN_VERSION: JSON.stringify(version)},
123+
define: {
124+
YARN_VERSION: JSON.stringify(version),
125+
...(this.noMinify ? {} : {
126+
// For React
127+
'process.env.NODE_ENV': JSON.stringify(`production`),
128+
// For ink
129+
'process.env.DEV': JSON.stringify(`false`),
130+
// For ourselves
131+
'process.env.TEST_ENV': `false`,
132+
// mkdirp
133+
'process.env.__TESTING_MKDIRP_PLATFORM__': `false`,
134+
'process.env.__TESTING_MKDIRP_NODE_VERSION__': `false`,
135+
'process.env.__FAKE_PLATFORM__': `false`,
136+
}),
137+
},
124138
outfile: output,
125139
logLevel: `silent`,
126140
format: `iife`,

yarn.lock

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14857,7 +14857,7 @@ __metadata:
1485714857
languageName: node
1485814858
linkType: hard
1485914859

14860-
"ink@npm:^3.0.8":
14860+
"ink@npm:3.0.8":
1486114861
version: 3.0.8
1486214862
resolution: "ink@npm:3.0.8"
1486314863
dependencies:
@@ -14894,6 +14894,43 @@ __metadata:
1489414894
languageName: node
1489514895
linkType: hard
1489614896

14897+
"ink@patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch":
14898+
version: 3.0.8
14899+
resolution: "ink@patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch::version=3.0.8&hash=1e50c6"
14900+
dependencies:
14901+
ansi-escapes: "npm:^4.2.1"
14902+
auto-bind: "npm:4.0.0"
14903+
chalk: "npm:^4.1.0"
14904+
cli-boxes: "npm:^2.2.0"
14905+
cli-cursor: "npm:^3.1.0"
14906+
cli-truncate: "npm:^2.1.0"
14907+
code-excerpt: "npm:^3.0.0"
14908+
indent-string: "npm:^4.0.0"
14909+
is-ci: "npm:^2.0.0"
14910+
lodash: "npm:^4.17.20"
14911+
patch-console: "npm:^1.0.0"
14912+
react-devtools-core: "npm:^4.6.0"
14913+
react-reconciler: "npm:^0.24.0"
14914+
scheduler: "npm:^0.18.0"
14915+
signal-exit: "npm:^3.0.2"
14916+
slice-ansi: "npm:^3.0.0"
14917+
stack-utils: "npm:^2.0.2"
14918+
string-length: "npm:^3.1.0"
14919+
type-fest: "npm:^0.12.0"
14920+
widest-line: "npm:^3.1.0"
14921+
wrap-ansi: "npm:^6.2.0"
14922+
ws: "npm:^7.2.5"
14923+
yoga-layout-prebuilt: "npm:^1.9.6"
14924+
peerDependencies:
14925+
"@types/react": ">=16.8.0"
14926+
react: ">=16.8.0"
14927+
peerDependenciesMeta:
14928+
"@types/react":
14929+
optional: true
14930+
checksum: 3526d08c45a6456c7f20160775da24b793838dece2af4996a077d0b48c8e5fe41ff07407a9f3e063518c9497cb240148f9af96a7fc102e3f11d76e5b0d96afcf
14931+
languageName: node
14932+
linkType: hard
14933+
1489714934
"inline-style-parser@npm:0.1.1":
1489814935
version: 0.1.1
1489914936
resolution: "inline-style-parser@npm:0.1.1"

0 commit comments

Comments
 (0)