@aeriajs/cli 0.0.192 → 0.0.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,12 @@
1
- export declare const buildAeriaLang: () => Promise<{
2
- emittedFiles: Record<string, string>;
3
- success: boolean;
4
- ast: import("@aeriajs/compiler").ProgramNode;
5
- errors: import("@aeriajs/compiler").Diagnostic[];
6
- errorCount: number;
7
- } | undefined>;
1
+ export declare const SCHEMAS_DIR = "schemas";
8
2
  export declare const buildAeriaLangPhase: () => Promise<{
9
3
  readonly _tag: "Result";
10
4
  readonly error: undefined;
11
- readonly result: "skipped aeria-lang build (@aeria-lang/build dependency is absent)";
5
+ readonly result: "skipped build as the schemas directory schemas wasn't found";
6
+ } | {
7
+ readonly _tag: "Result";
8
+ readonly error: undefined;
9
+ readonly result: "no aeria schemas to build";
12
10
  } | {
13
11
  readonly _tag: "Error";
14
12
  readonly error: string;
@@ -16,5 +14,5 @@ export declare const buildAeriaLangPhase: () => Promise<{
16
14
  } | {
17
15
  readonly _tag: "Result";
18
16
  readonly error: undefined;
19
- readonly result: "no aeria files to build" | "aeria files built";
17
+ readonly result: "aeria schemas built";
20
18
  }>;
@@ -1,29 +1,19 @@
1
1
  import { Result } from '@aeriajs/types';
2
- export const buildAeriaLang = async () => {
3
- try {
4
- const { compileFromFiles } = await import('@aeriajs/compiler');
5
- return await compileFromFiles('schemas', {
6
- outDir: '.aeria/out',
7
- });
8
- }
9
- catch (err) {
10
- if (err.code !== 'MODULE_NOT_FOUND') {
11
- throw err;
12
- }
13
- }
14
- };
2
+ import { compileFromFiles } from '@aeriajs/compiler';
3
+ import * as fs from 'node:fs';
4
+ export const SCHEMAS_DIR = 'schemas';
15
5
  export const buildAeriaLangPhase = async () => {
16
- const result = await buildAeriaLang();
17
- if (!result) {
18
- return Result.result('skipped aeria-lang build (@aeria-lang/build dependency is absent)');
6
+ if (!fs.existsSync(SCHEMAS_DIR)) {
7
+ return Result.result(`skipped build as the schemas directory ${SCHEMAS_DIR} wasn't found`);
8
+ }
9
+ const result = await compileFromFiles(SCHEMAS_DIR, {
10
+ outDir: '.aeria/out',
11
+ });
12
+ if (!('emittedFiles' in result)) {
13
+ return Result.result('no aeria schemas to build');
19
14
  }
20
15
  if (!result.success) {
21
16
  return Result.error(result.errors.map((error) => `\n${error.fileLocation}:${error.location.line} at column (${error.location.start}-${error.location.end}) - ${error.message}`).join(' | '));
22
17
  }
23
- if (Object.keys(result.emittedFiles).length === 0) {
24
- return Result.result('no aeria files to build');
25
- }
26
- return Result.result(Object.keys(result.emittedFiles).length > 0
27
- ? 'aeria files built'
28
- : 'no aeria files to build');
18
+ return Result.result('aeria schemas built');
29
19
  };
package/dist/compile.js CHANGED
@@ -109,6 +109,9 @@ export const compilationPhase = async (options = {}) => {
109
109
  const transpileCtx = await transpile.init({
110
110
  outdir: tsConfig.compilerOptions.outDir,
111
111
  sourcemap: tsConfig.compilerOptions.sourceMap,
112
+ format: tsConfig.compilerOptions.module === ts.ModuleKind.CommonJS
113
+ ? 'cjs'
114
+ : 'esm',
112
115
  });
113
116
  await transpileCtx.rebuild();
114
117
  await transpileCtx.dispose();
package/dist/watch.js CHANGED
@@ -1,3 +1,4 @@
1
+ import ts from 'typescript';
1
2
  import * as chokidar from 'chokidar';
2
3
  import { fileURLToPath } from 'node:url';
3
4
  import { spawn, fork } from 'node:child_process';
@@ -61,6 +62,9 @@ export const watch = async (options = {}) => {
61
62
  const transpileCtx = !options.useTsc
62
63
  ? await transpile.init({
63
64
  outdir: tsConfig.compilerOptions.outDir,
65
+ format: tsConfig.compilerOptions.module === ts.ModuleKind.CommonJS
66
+ ? 'cjs'
67
+ : 'esm',
64
68
  sourcemap: tsConfig.compilerOptions.sourceMap,
65
69
  })
66
70
  : null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aeriajs/cli",
3
3
  "type": "module",
4
- "version": "0.0.192",
4
+ "version": "0.0.193",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -42,7 +42,7 @@
42
42
  "peerDependencies": {
43
43
  "@aeriajs/builtins": "^0.0.242",
44
44
  "@aeriajs/common": "^0.0.136",
45
- "@aeriajs/compiler": "^0.0.7",
45
+ "@aeriajs/compiler": "^0.0.8",
46
46
  "@aeriajs/core": "^0.0.242",
47
47
  "@aeriajs/entrypoint": "^0.0.140",
48
48
  "@aeriajs/types": "^0.0.118"