Skip to content
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
6 changes: 5 additions & 1 deletion packages/cli/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export class BuildCommand {
await intentCliFileTransformer.load(TS_CONFIG);

const SWC_OPTIONS = defaultSwcOptionsFactory(TS_CONFIG, INTENT_CONFIG);
await this.swcFileTransformer.handle(TS_CONFIG, INTENT_CONFIG, SWC_OPTIONS);
await this.swcFileTransformer.handle(
tsConfigPath,
INTENT_CONFIG,
SWC_OPTIONS
);
}
}
2 changes: 1 addition & 1 deletion packages/cli/commands/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class StartServerCommand {
const onSuccessHook = this.createOnSuccessHook(INTENT_CONFIG);

const swcOnUpdateHook = await this.swcFileTransformer.handle(
TS_CONFIG,
tsConfigPath,
INTENT_CONFIG,
SWC_OPTIONS
);
Expand Down
8 changes: 6 additions & 2 deletions packages/cli/lib/dev-server/swc/swc-file-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ import { ParsedCommandLine } from "typescript";
import { Output } from "@swc/core";
import { transformFile } from "@swc/core";
import { IntentConfiguration } from "../../configuration/interface.js";
import { TsConfigLoader } from "../typescript/tsconfig-loader.js";

const { mkdirSync, writeFileSync } = fs;

export class SwcFileTransformer {
protected readonly tsConfigLoader = new TsConfigLoader();

async handle(
TS_CONFIG: ParsedCommandLine,
tsConfigPath: string,
INTENT_CONFIG: IntentConfiguration,
options: ReturnType<typeof defaultSwcOptionsFactory>
): Promise<() => Promise<void>> {
const TS_CONFIG = this.tsConfigLoader.load(tsConfigPath);
await this.transformFiles(TS_CONFIG, options, INTENT_CONFIG);

const onUpdate = () => {
const TS_CONFIG = this.tsConfigLoader.load(tsConfigPath);
return this.transformFiles(TS_CONFIG, options, INTENT_CONFIG);
};

Expand All @@ -34,7 +39,6 @@ export class SwcFileTransformer {
const { fileNames = [] } = TS_CONFIG;
const isWindows = process.platform === "win32";
const fileTransformationPromises = [];

for (const filePath of fileNames) {
const fileTransformerPromise = (resolve: Function) =>
transformFile(filePath, { ...options, filename: filePath })
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@intentjs/cli",
"version": "0.0.21",
"version": "0.0.22",
"description": "Helper commands for building Intent application.",
"repository": {
"type": "git",
Expand Down
Loading