Skip to content

Commit 44d50cc

Browse files
committed
core: update rollup + favor: fix dev again
1 parent 85bb05e commit 44d50cc

File tree

8 files changed

+29
-30
lines changed

8 files changed

+29
-30
lines changed

packages/core/exports.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ interface Promise<T> {
1414
await: T;
1515
}
1616

17-
export let environment: Record<string, unknown>;
17+
declare global {
18+
export let environment: Record<string, unknown>;
19+
}
20+
21+
export {};

packages/core/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"patch-package": "^8.0.0",
106106
"postcss-load-config": "^6.0.1",
107107
"prettier": "^3.2.5",
108-
"rollup": "^4.17.2",
108+
"rollup": "^4.27.2",
109109
"rollup-plugin-dts": "^6.1.0",
110110
"rollup-plugin-esbuild": "^6.1.0",
111111
"rollup-plugin-generate-package-json": "^3.2.0",

packages/core/rollup.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default [
4949
({ dir, types, input }) =>
5050
/** @type {import("rollup").RollupOptions} */ ({
5151
input,
52-
treeshake: true,
52+
treeshake: types,
5353
output: {
5454
dir,
5555
format: "es",

packages/core/src/entry/testing/cli/runner.ts

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ import { cleanObject } from "../../../util/clean-object.js";
4747
import { KV } from "../../../core/formats/kv-fmt.js";
4848
import { PardonError } from "../../../core/error.js";
4949

50-
declare global {
51-
let environment: Record<string, unknown>;
52-
}
53-
5450
export type TestSetup = {
5551
test: () => Promise<void>;
5652
testcase: string;

packages/core/src/runtime/environment.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
1010
governing permissions and limitations under the License.
1111
*/
1212
import { tracking } from "../core/tracking.js";
13+
import "../../exports.js";
1314

1415
export async function initTrackingEnvironment() {
1516
const { awaited: environmentUpdates, track: trackEnvironmentUpdate } =

packages/favor/package-lock.json

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/favor/vite.base.config.ts

+5-17
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,25 @@ interface ForgedConfigEnv<
3333
forgeConfigSelf: VitePluginConfig[K][number];
3434
}
3535

36-
export function extendMainConfig(
37-
config: UserConfigExport,
38-
target?: "es" | "cjs",
39-
): UserConfigExport {
36+
export function extendMainConfig(config: UserConfigExport): UserConfigExport {
4037
return async (env: ConfigEnv) =>
4138
await applyBaseBuildConfig(
4239
env as ForgedConfigEnv<"build">,
4340
config,
4441
"main",
45-
target ?? "es",
42+
"es",
4643
);
4744
}
4845

4946
export function extendPreloadConfig(
5047
config: UserConfigExport,
51-
target?: "cjs" | "es",
5248
): UserConfigExport {
5349
return async (env: ConfigEnv) =>
5450
await applyBaseBuildConfig(
5551
env as ForgedConfigEnv<"build">,
5652
config,
5753
"preload",
58-
target ?? "cjs",
54+
"cjs",
5955
);
6056
}
6157

@@ -107,16 +103,7 @@ async function applyBaseBuildConfig(
107103
const { root, mode, command } = env;
108104
const { entry } = env.forgeConfigSelf;
109105
const format = target;
110-
const esExt = pkg.type === "module" ? "js" : "mjs";
111-
const cjsExt = pkg.type === "module" ? "cjs" : "js";
112-
const targetExt =
113-
target === "cjs"
114-
? type === "preload"
115-
? "cjs"
116-
: cjsExt
117-
: type === "preload"
118-
? "mjs"
119-
: esExt;
106+
const targetExt = target === "cjs" ? "cjs" : "js";
120107

121108
const define = env.forgeConfig.renderer
122109
.map(({ name }) => name)
@@ -162,6 +149,7 @@ async function applyBaseBuildConfig(
162149
}),
163150
rollupOptions: {
164151
external,
152+
treeshake: false,
165153
...(type === "preload" && {
166154
input: entry,
167155
output: {

0 commit comments

Comments
 (0)