Skip to content

Commit 7723d32

Browse files
authored
ref(build): Use sucrase for watch npm builds (#5059)
This follows up on #5035, which switched our main build commands to use rollup and sucrase instead of tsc, and brings that same change to our `build:watch` commands. Note: Running either of these `watch` commands produces different feedback than the `tsc` watch commands we're used to, in that the `build:types` component auto-watches dependencies (and will trigger a cascading rebuild on change), but the `build:rollup` component doesn't (and therefore only rebuilds the changed package). The reason for this is that sucrase and rollup are truly only *trans*piling (IOW, smushing the code touching other packages around in a non-semantic way, only really worried about whether it's legal JS, not whether it plays the way it should with those other packages), not *com*piling (actually understanding the entire, cross-package AST and refusing to produce code if the interfaces between packages don't match up). The utility of `tsc`'s rebuild of dependent packages was never actually to change the built code of those packages, it was just that the rebuild attempt forced a cascading typecheck, so we could know what _we_ had to change in the dependent packages' code. The process building types still serves this function, but the process building code doesn't need to and therefore there's no need for the cascade. (As you'll see in the conversation below, I myself was fuzzy on this point at first, which is why I'm spelling it out here quite so explicitly, in case any future readers stumble into the same wrong assumptions I did.)
1 parent cd71864 commit 7723d32

File tree

14 files changed

+18
-18
lines changed

14 files changed

+18
-18
lines changed

packages/browser/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
"build:esm": "tsc -p tsconfig.esm.json",
5252
"build:rollup": "rollup -c rollup.npm.config.js",
5353
"build:types": "tsc -p tsconfig.types.json",
54-
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch build:types:watch",
54+
"build:watch": "run-p build:rollup:watch build:bundle:watch build:types:watch",
5555
"build:bundle:watch": "rollup --config rollup.bundle.config.js --watch",
5656
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
5757
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
58-
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
58+
"build:dev:watch": "run-p build:rollup:watch build:types:watch",
5959
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
6060
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",
6161
"build:types:watch": "tsc -p tsconfig.types.json --watch",

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"build:esm": "tsc -p tsconfig.esm.json",
3030
"build:rollup": "rollup -c rollup.npm.config.js",
3131
"build:types": "tsc -p tsconfig.types.json",
32-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
32+
"build:watch": "run-p build:rollup:watch build:types:watch",
3333
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
3434
"build:dev:watch": "run-s build:watch",
3535
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/gatsby/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"build:plugin": "tsc -p tsconfig.plugin.json",
4444
"build:rollup": "rollup -c rollup.npm.config.js",
4545
"build:types": "tsc -p tsconfig.types.json",
46-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
46+
"build:watch": "run-p build:rollup:watch build:types:watch",
4747
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
4848
"build:dev:watch": "run-s build:watch",
4949
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/hub/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"build:esm": "tsc -p tsconfig.esm.json",
2929
"build:rollup": "rollup -c rollup.npm.config.js",
3030
"build:types": "tsc -p tsconfig.types.json",
31-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
31+
"build:watch": "run-p build:rollup:watch build:types:watch",
3232
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
3333
"build:dev:watch": "run-s build:watch",
3434
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/integrations/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build:esm": "tsc -p tsconfig.esm.json",
3434
"build:rollup": "rollup -c rollup.npm.config.js",
3535
"build:types": "tsc -p tsconfig.types.json",
36-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
36+
"build:watch": "run-p build:rollup:watch build:types:watch",
3737
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
3838
"build:dev:watch": "run-s build:watch",
3939
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/nextjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"build:esm": "tsc -p tsconfig.esm.json",
5151
"build:rollup": "rollup -c rollup.npm.config.js",
5252
"build:types": "tsc -p tsconfig.types.json",
53-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
53+
"build:watch": "run-p build:rollup:watch build:types:watch",
5454
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
5555
"build:dev:watch": "run-s build:watch",
5656
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"build:esm": "tsc -p tsconfig.esm.json",
4242
"build:rollup": "rollup -c rollup.npm.config.js",
4343
"build:types": "tsc -p tsconfig.types.json",
44-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
44+
"build:watch": "run-p build:rollup:watch build:types:watch",
4545
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
4646
"build:dev:watch": "run-s build:watch",
4747
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"build:esm": "tsc -p tsconfig.esm.json",
5656
"build:rollup": "rollup -c rollup.npm.config.js",
5757
"build:types": "tsc -p tsconfig.types.json",
58-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
58+
"build:watch": "run-p build:rollup:watch build:types:watch",
5959
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
6060
"build:dev:watch": "run-s build:watch",
6161
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/serverless/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"build:esm": "tsc -p tsconfig.esm.json",
4747
"build:rollup": "rollup -c rollup.npm.config.js",
4848
"build:types": "tsc -p tsconfig.types.json",
49-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
49+
"build:watch": "run-p build:rollup:watch build:types:watch",
5050
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
5151
"build:dev:watch": "run-s build:watch",
5252
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/tracing/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"build:esm": "tsc -p tsconfig.esm.json",
3535
"build:rollup": "rollup -c rollup.npm.config.js",
3636
"build:types": "tsc -p tsconfig.types.json",
37-
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch build:types:watch",
37+
"build:watch": "run-p build:rollup:watch build:bundle:watch build:types:watch",
3838
"build:bundle:watch": "rollup --config rollup.bundle.config.js --watch",
3939
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
40-
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
40+
"build:dev:watch": "run-p build:rollup:watch build:types:watch",
4141
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
4242
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
4343
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",

packages/types/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build:esm": "tsc -p tsconfig.esm.json",
2424
"build:rollup": "rollup -c rollup.npm.config.js",
2525
"build:types": "tsc -p tsconfig.types.json",
26-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
26+
"build:watch": "run-p build:rollup:watch build:types:watch",
2727
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
2828
"build:dev:watch": "run-s build:watch",
2929
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"build:esm": "tsc -p tsconfig.esm.json",
3333
"build:rollup": "yarn ts-node scripts/buildRollup.ts",
3434
"build:types": "tsc -p tsconfig.types.json",
35-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
35+
"build:watch": "run-p build:rollup:watch build:types:watch",
3636
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
3737
"build:dev:watch": "run-s build:watch",
3838
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",

packages/vue/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"build:esm": "tsc -p tsconfig.esm.json",
3535
"build:rollup": "rollup -c rollup.npm.config.js",
3636
"build:types": "tsc -p tsconfig.types.json",
37-
"build:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
37+
"build:watch": "run-p build:rollup:watch build:types:watch",
3838
"build:bundle:watch": "rollup --config --watch",
3939
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
40-
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
40+
"build:dev:watch": "run-p build:rollup:watch build:types:watch",
4141
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
4242
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
4343
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",

packages/wasm/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
"build:esm": "tsc -p tsconfig.esm.json",
3939
"build:rollup": "rollup -c rollup.npm.config.js",
4040
"build:types": "tsc -p tsconfig.types.json",
41-
"build:watch": "run-p build:cjs:watch build:esm:watch build:bundle:watch build:types:watch",
41+
"build:watch": "run-p build:rollup:watch build:bundle:watch build:types:watch",
4242
"build:bundle:watch": "rollup --config rollup.bundle.config.js --watch",
4343
"build:cjs:watch": "tsc -p tsconfig.cjs.json --watch",
44-
"build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch",
44+
"build:dev:watch": "run-p build:rollup:watch build:types:watch",
4545
"build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***",
4646
"build:esm:watch": "tsc -p tsconfig.esm.json --watch",
4747
"build:rollup:watch": "rollup -c rollup.npm.config.js --watch",

0 commit comments

Comments
 (0)