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

perf: reduce bundle size #4315

Merged
merged 2 commits into from
Apr 7, 2022
Merged
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
106 changes: 53 additions & 53 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file added .yarn/cache/ink-patch-1689893309-3526d08c45.zip
Binary file not shown.
31 changes: 31 additions & 0 deletions .yarn/patches/ink-npm-3.0.8-3a8005f59f.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/build/ink.js b/build/ink.js
index f292bccdd049835ded848da83a6daac1e4f70416..54c4ebf36dc0c8f7f2580a5e69869848c83dc46f 100644
--- a/build/ink.js
+++ b/build/ink.js
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
-const lodash_1 = require("lodash");
+const lodash_1_throttle = require("lodash/throttle");
const log_update_1 = __importDefault(require("./log-update"));
const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
const is_ci_1 = __importDefault(require("is-ci"));
@@ -90,7 +90,7 @@ class Ink {
this.rootNode = dom.createNode('ink-root');
this.rootNode.onRender = options.debug
? this.onRender
- : lodash_1.throttle(this.onRender, 32, {
+ : lodash_1_throttle(this.onRender, 32, {
leading: true,
trailing: true
});
@@ -98,7 +98,7 @@ class Ink {
this.log = log_update_1.default.create(options.stdout);
this.throttledLog = options.debug
? this.log
- : lodash_1.throttle(this.log, undefined, {
+ : lodash_1_throttle(this.log, undefined, {
leading: true,
trailing: true
});
24 changes: 24 additions & 0 deletions .yarn/versions/4bdc9471.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
releases:
"@yarnpkg/builder": patch
"@yarnpkg/cli": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"typescript": "4.6.1-rc"
},
"resolutions": {
"ink": "patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch",
"yoga-layout-prebuilt": "patch:yoga-layout-prebuilt@1.10.0#./.yarn/patches/yoga-layout-prebuilt.patch"
},
"dependenciesMeta": {
Expand Down
16 changes: 15 additions & 1 deletion packages/yarnpkg-builder/sources/commands/build/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,21 @@ export default class BuildBundleCommand extends Command {
},
entryPoints: [path.join(basedir, `sources/cli.ts`)],
bundle: true,
define: {YARN_VERSION: JSON.stringify(version)},
define: {
YARN_VERSION: JSON.stringify(version),
...(this.noMinify ? {} : {
// For React
'process.env.NODE_ENV': JSON.stringify(`production`),
// For ink
'process.env.DEV': JSON.stringify(`false`),
// For ourselves
'process.env.TEST_ENV': `false`,
// mkdirp
'process.env.__TESTING_MKDIRP_PLATFORM__': `false`,
'process.env.__TESTING_MKDIRP_NODE_VERSION__': `false`,
'process.env.__FAKE_PLATFORM__': `false`,
}),
},
outfile: output,
logLevel: `silent`,
format: `iife`,
Expand Down
39 changes: 38 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14857,7 +14857,7 @@ __metadata:
languageName: node
linkType: hard

"ink@npm:^3.0.8":
"ink@npm:3.0.8":
version: 3.0.8
resolution: "ink@npm:3.0.8"
dependencies:
Expand Down Expand Up @@ -14894,6 +14894,43 @@ __metadata:
languageName: node
linkType: hard

"ink@patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch":
version: 3.0.8
resolution: "ink@patch:ink@npm%3A3.0.8#~/.yarn/patches/ink-npm-3.0.8-3a8005f59f.patch::version=3.0.8&hash=1e50c6"
dependencies:
ansi-escapes: "npm:^4.2.1"
auto-bind: "npm:4.0.0"
chalk: "npm:^4.1.0"
cli-boxes: "npm:^2.2.0"
cli-cursor: "npm:^3.1.0"
cli-truncate: "npm:^2.1.0"
code-excerpt: "npm:^3.0.0"
indent-string: "npm:^4.0.0"
is-ci: "npm:^2.0.0"
lodash: "npm:^4.17.20"
patch-console: "npm:^1.0.0"
react-devtools-core: "npm:^4.6.0"
react-reconciler: "npm:^0.24.0"
scheduler: "npm:^0.18.0"
signal-exit: "npm:^3.0.2"
slice-ansi: "npm:^3.0.0"
stack-utils: "npm:^2.0.2"
string-length: "npm:^3.1.0"
type-fest: "npm:^0.12.0"
widest-line: "npm:^3.1.0"
wrap-ansi: "npm:^6.2.0"
ws: "npm:^7.2.5"
yoga-layout-prebuilt: "npm:^1.9.6"
peerDependencies:
"@types/react": ">=16.8.0"
react: ">=16.8.0"
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 3526d08c45a6456c7f20160775da24b793838dece2af4996a077d0b48c8e5fe41ff07407a9f3e063518c9497cb240148f9af96a7fc102e3f11d76e5b0d96afcf
languageName: node
linkType: hard

"inline-style-parser@npm:0.1.1":
version: 0.1.1
resolution: "inline-style-parser@npm:0.1.1"
Expand Down