Skip to content

Commit

Permalink
remove unnecessary union
Browse files Browse the repository at this point in the history
  • Loading branch information
verytactical committed Jan 16, 2025
1 parent f1da93a commit d4e2c44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Config, verifyConfig } from "./config/parseConfig";
import { ILogger } from "./context/logger";
import { build } from "./pipeline/build";
import { createVirtualFileSystem } from "./vfs/createVirtualFileSystem";
import files from "./stdlib/stdlib";

export async function run(args: {
config: Config;
Expand All @@ -15,7 +16,7 @@ export async function run(args: {
const project = createVirtualFileSystem("/", args.files, false);

// Create stdlib path
const stdlib = "@stdlib";
const stdlib = createVirtualFileSystem("@stdlib", files);

// Compile
let success = true;
Expand Down
5 changes: 3 additions & 2 deletions src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { createNodeFileSystem } from "./vfs/createNodeFileSystem";
import { build } from "./pipeline/build";
import { LogLevel, Logger } from "./context/logger";
import { TactErrorCollection } from "./error/errors";
import { stdlibPath } from "./stdlib/path";
import { createVirtualFileSystem } from "./vfs/createVirtualFileSystem";
import files from "./stdlib/stdlib";

type AdditionalCliOptions = {
mode?: ConfigProject["mode"];
Expand Down Expand Up @@ -116,7 +117,7 @@ export async function run(args: {
configWithRootPath.rootPath as string,
false,
);
const stdlib = createNodeFileSystem(stdlibPath, false); // Improves developer experience
const stdlib = createVirtualFileSystem("@stdlib", files);
for (const config of projects) {
logger.info(`💼 Compiling project ${config.name} ...`);
let cliConfig = { ...config };
Expand Down
9 changes: 2 additions & 7 deletions src/pipeline/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import { CompilerContext } from "../context/context";
import { funcCompile } from "../func/funcCompile";
import { writeReport } from "../generator/writeReport";
import { getRawAST } from "../context/store";
import files from "../stdlib/stdlib";
import { ILogger, Logger } from "../context/logger";
import { PackageFileFormat } from "../packaging/fileFormat";
import { packageCode } from "../packaging/packageCode";
import { createABITypeRefFromTypeRef } from "../types/resolveABITypeRef";
import { getContracts, getType } from "../types/resolveDescriptors";
import { posixNormalize } from "../utils/filePath";
import { createVirtualFileSystem } from "../vfs/createVirtualFileSystem";
import { VirtualFileSystem } from "../vfs/VirtualFileSystem";
import { compile } from "./compile";
import { precompile } from "./precompile";
Expand Down Expand Up @@ -51,16 +49,13 @@ export function enableFeatures(
export async function build(args: {
config: ConfigProject;
project: VirtualFileSystem;
stdlib: string | VirtualFileSystem;
stdlib: VirtualFileSystem;
logger?: ILogger;
parser?: Parser;
ast?: FactoryAst;
}): Promise<{ ok: boolean; error: TactErrorCollection[] }> {
const { config, project } = args;
const stdlib =
typeof args.stdlib === "string"
? createVirtualFileSystem(args.stdlib, files)
: args.stdlib;
const stdlib = args.stdlib;
const ast: FactoryAst = args.ast ?? getAstFactory();
const parser: Parser =
args.parser ?? getParser(ast, config.options?.parser ?? defaultParser);
Expand Down

0 comments on commit d4e2c44

Please sign in to comment.