Skip to content

Commit d49e905

Browse files
committed
Log extracted direct dependencies info instead of unused build metaoutputs
1 parent 13cbc9f commit d49e905

File tree

4 files changed

+6
-57
lines changed

4 files changed

+6
-57
lines changed

packages/cli-v3/e2e/compile.ts

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { esbuildDecorators } from "@anatine/esbuild-decorators";
22
import { build } from "esbuild";
33
import { readFileSync } from "node:fs";
44
import { writeFile } from "node:fs/promises";
5-
import { basename, join, posix, relative, resolve, sep } from "node:path";
5+
import { join, resolve } from "node:path";
66
import invariant from "tiny-invariant";
77

88
import {
@@ -68,6 +68,8 @@ export async function compile(options: CompileOptions) {
6868
const e2eJsProject = new E2EJavascriptProject(config.projectDir, packageManager);
6969
const directDependenciesMeta = await e2eJsProject.extractDirectDependenciesMeta();
7070

71+
logger.debug("Direct dependencies metadata", directDependenciesMeta);
72+
7173
const result = await build({
7274
stdin: {
7375
contents: workerContents,
@@ -161,27 +163,6 @@ export async function compile(options: CompileOptions) {
161163

162164
logger.debug(`Writing compiled files to ${tempDir}`);
163165

164-
// Get the metaOutput for the result build
165-
const pathsToProjectDir = relative(
166-
join(process.cwd(), "e2e", "fixtures"),
167-
config.projectDir
168-
).split(sep);
169-
170-
const metaOutput =
171-
result.metafile!.outputs[
172-
posix.join("e2e", "fixtures", ...pathsToProjectDir, "out", "stdin.js")
173-
];
174-
175-
invariant(metaOutput, "Meta output for the result build is missing");
176-
177-
// Get the metaOutput for the entryPoint build
178-
const entryPointMetaOutput =
179-
entryPointResult.metafile!.outputs[
180-
posix.join("e2e", "fixtures", ...pathsToProjectDir, "out", "stdin.js")
181-
];
182-
183-
invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
184-
185166
// Get the outputFile and the sourceMapFile for the result build
186167
const workerOutputFile = result.outputFiles.find(
187168
(file) => file.path === join(config.projectDir, "out", "stdin.js")
@@ -215,9 +196,7 @@ export async function compile(options: CompileOptions) {
215196

216197
return {
217198
directDependenciesMeta,
218-
workerMetaOutput: metaOutput,
219199
workerOutputFile,
220-
entryPointMetaOutput,
221200
entryPointOutputFile,
222201
};
223202
}

packages/cli-v3/e2e/handleDependencies.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

33
import { log } from "@clack/prompts";
4-
import { Metafile } from "esbuild";
54
import { join } from "node:path";
65

76
import { SkipLoggingError } from "../src/cli/common.js";
@@ -20,8 +19,6 @@ import { DependencyMeta } from "../src/utilities/javascriptProject.js";
2019

2120
type HandleDependenciesOptions = {
2221
directDependenciesMeta: Record<string, DependencyMeta>;
23-
entryPointMetaOutput: Metafile["outputs"]["out/stdin.js"];
24-
metaOutput: Metafile["outputs"]["out/stdin.js"];
2522
packageManager: PackageManager;
2623
resolvedConfig: ReadConfigResult;
2724
tempDir: string;
@@ -33,18 +30,11 @@ export async function handleDependencies(options: HandleDependenciesOptions) {
3330
}
3431
const {
3532
directDependenciesMeta,
36-
entryPointMetaOutput,
37-
metaOutput,
3833
packageManager,
3934
resolvedConfig: { config },
4035
tempDir,
4136
} = options;
4237

43-
logger.debug("Imports for the worker and entryPoint builds", {
44-
workerImports: metaOutput.imports,
45-
entryPointImports: entryPointMetaOutput.imports,
46-
});
47-
4838
const javascriptProject = new E2EJavascriptProject(config.projectDir, packageManager);
4939

5040
const dependencies = await resolveRequiredDependencies(directDependenciesMeta, config);

packages/cli-v3/e2e/index.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { createDeployHash } from "./createDeployHash";
1818
import { handleDependencies } from "./handleDependencies";
1919
import { E2EOptions, E2EOptionsSchema } from "./schemas";
2020
import { fixturesConfig, TestCase } from "./fixtures.config";
21-
import { Metafile, OutputFile } from "esbuild";
21+
import { OutputFile } from "esbuild";
2222
import { findUpMultiple } from "find-up";
2323
import { DependencyMeta } from "../src/utilities/javascriptProject";
2424

@@ -165,9 +165,7 @@ if (testCases.length > 0) {
165165
}
166166

167167
let directDependenciesMeta: Record<string, DependencyMeta>;
168-
let entryPointMetaOutput: Metafile["outputs"]["out/stdin.js"];
169168
let entryPointOutputFile: OutputFile;
170-
let workerMetaOutput: Metafile["outputs"]["out/stdin.js"];
171169
let workerOutputFile: OutputFile;
172170

173171
const compileExpect = expect(
@@ -178,9 +176,7 @@ if (testCases.length > 0) {
178176
tempDir,
179177
});
180178
directDependenciesMeta = compilationResult.directDependenciesMeta;
181-
entryPointMetaOutput = compilationResult.entryPointMetaOutput;
182179
entryPointOutputFile = compilationResult.entryPointOutputFile;
183-
workerMetaOutput = compilationResult.workerMetaOutput;
184180
workerOutputFile = compilationResult.workerOutputFile;
185181
})(),
186182
wantCompilationError ? "does not compile" : "compiles"
@@ -205,8 +201,6 @@ if (testCases.length > 0) {
205201
(async () => {
206202
dependencies = await handleDependencies({
207203
directDependenciesMeta: directDependenciesMeta!,
208-
entryPointMetaOutput: entryPointMetaOutput!,
209-
metaOutput: workerMetaOutput!,
210204
resolvedConfig: resolvedConfig!,
211205
tempDir,
212206
packageManager,

packages/cli-v3/src/commands/deploy.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,8 @@ async function compileProject(
11691169
const javascriptProject = new JavascriptProject(config.projectDir);
11701170
const directDependenciesMeta = await javascriptProject.extractDirectDependenciesMeta();
11711171

1172+
logger.debug("Direct dependencies metadata", directDependenciesMeta);
1173+
11721174
const result = await build({
11731175
stdin: {
11741176
contents: workerContents,
@@ -1284,17 +1286,6 @@ async function compileProject(
12841286

12851287
logger.debug(`Writing compiled files to ${tempDir}`);
12861288

1287-
// Get the metaOutput for the result build
1288-
const metaOutput = result.metafile!.outputs[posix.join("out", "stdin.js")];
1289-
1290-
invariant(metaOutput, "Meta output for the result build is missing");
1291-
1292-
// Get the metaOutput for the entryPoint build
1293-
const entryPointMetaOutput =
1294-
entryPointResult.metafile!.outputs[posix.join("out", "stdin.js")];
1295-
1296-
invariant(entryPointMetaOutput, "Meta output for the entryPoint build is missing");
1297-
12981289
// Get the outputFile and the sourceMapFile for the result build
12991290
const workerOutputFile = result.outputFiles.find(
13001291
(file) => file.path === join(config.projectDir, "out", "stdin.js")
@@ -1326,11 +1317,6 @@ async function compileProject(
13261317
// Save the entryPoint outputFile to /tmp/dir/index.js
13271318
await writeFile(join(tempDir, "index.js"), entryPointOutputFile.text);
13281319

1329-
logger.debug("Imports for the worker and entryPoint builds", {
1330-
workerImports: metaOutput.imports,
1331-
entryPointImports: entryPointMetaOutput.imports,
1332-
});
1333-
13341320
const dependencies = await resolveRequiredDependencies(directDependenciesMeta, config);
13351321

13361322
logger.debug("gatherRequiredDependencies()", { dependencies });

0 commit comments

Comments
 (0)