@mettlecast/domain-cli 0.2.1 → 0.2.2
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.
|
@@ -83,20 +83,10 @@ export async function loadModuleExports(absoluteFilePath) {
|
|
|
83
83
|
await mkdir(tibTmpDir, { recursive: true }).catch(() => undefined);
|
|
84
84
|
const tempPath = join(tibTmpDir, `tib-load-${randomBytes(8).toString('hex')}.mts`);
|
|
85
85
|
await writeFile(tempPath, makeEvalScript(absoluteFilePath), 'utf8');
|
|
86
|
-
// TSX_TSCONFIG_PATH forces tsx to use the specified tsconfig for ALL files it processes,
|
|
87
|
-
// including dynamically imported domain source files. Without this, tsx v4 uses the nearest
|
|
88
|
-
// package.json "type" field to decide CJS vs ESM — domain files without "type":"module"
|
|
89
|
-
// default to CJS, which cannot require() @mettlecast/domain-runtime (pure ESM).
|
|
90
|
-
// infra/modules/tsconfig.json (module: ESNext) is always present in scaffold projects.
|
|
91
|
-
const tsxEnv = {
|
|
92
|
-
...process.env,
|
|
93
|
-
TSX_TSCONFIG_PATH: join(process.cwd(), 'tsconfig.json'),
|
|
94
|
-
};
|
|
95
86
|
try {
|
|
96
87
|
return await new Promise((resolve, reject) => {
|
|
97
88
|
const tsxChild = spawn(process.execPath, [tsxCli, tempPath], {
|
|
98
89
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
-
env: tsxEnv,
|
|
100
90
|
});
|
|
101
91
|
let stdout = '';
|
|
102
92
|
let stderr = '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { writeFile, unlink, mkdir } from 'node:fs/promises';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
3
|
import { join, dirname } from 'node:path';
|
|
5
4
|
import { randomBytes } from 'node:crypto';
|
|
6
5
|
import { createRequire } from 'node:module';
|
|
@@ -103,21 +102,10 @@ export async function loadModuleExports(absoluteFilePath: string): Promise<RawPr
|
|
|
103
102
|
const tempPath = join(tibTmpDir, `tib-load-${randomBytes(8).toString('hex')}.mts`);
|
|
104
103
|
await writeFile(tempPath, makeEvalScript(absoluteFilePath), 'utf8');
|
|
105
104
|
|
|
106
|
-
// TSX_TSCONFIG_PATH forces tsx to use the specified tsconfig for ALL files it processes,
|
|
107
|
-
// including dynamically imported domain source files. Without this, tsx v4 uses the nearest
|
|
108
|
-
// package.json "type" field to decide CJS vs ESM — domain files without "type":"module"
|
|
109
|
-
// default to CJS, which cannot require() @mettlecast/domain-runtime (pure ESM).
|
|
110
|
-
// infra/modules/tsconfig.json (module: ESNext) is always present in scaffold projects.
|
|
111
|
-
const tsxEnv = {
|
|
112
|
-
...process.env,
|
|
113
|
-
TSX_TSCONFIG_PATH: join(process.cwd(), 'tsconfig.json'),
|
|
114
|
-
};
|
|
115
|
-
|
|
116
105
|
try {
|
|
117
106
|
return await new Promise<RawPrimitiveExport[]>((resolve, reject) => {
|
|
118
107
|
const tsxChild = spawn(process.execPath, [tsxCli, tempPath], {
|
|
119
108
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
120
|
-
env: tsxEnv,
|
|
121
109
|
});
|
|
122
110
|
|
|
123
111
|
let stdout = '';
|