@karmaniverous/smoz 0.2.7 → 0.2.8
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.
- package/dist/cli/index.cjs +9 -2
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -636,6 +636,13 @@ const resolveTsxCommand = (root, tsEntry) => {
|
|
|
636
636
|
}
|
|
637
637
|
throw new Error('Inline requires tsx. Install it with "npm i -D tsx", or run "smoz dev -l offline".');
|
|
638
638
|
};
|
|
639
|
+
const resolveInlineEntry = (pkgRoot) => {
|
|
640
|
+
const compiled = path.resolve(pkgRoot, 'dist', 'mjs', 'cli', 'inline-server.js');
|
|
641
|
+
if (fs.existsSync(compiled))
|
|
642
|
+
return { entry: compiled, kind: 'compiled' };
|
|
643
|
+
const tsPath = path.resolve(pkgRoot, 'src', 'cli', 'local', 'inline.server', 'index.ts');
|
|
644
|
+
return { entry: tsPath, kind: 'ts' };
|
|
645
|
+
};
|
|
639
646
|
const launchInline = async (root, opts) => {
|
|
640
647
|
// Resolve the installed smoz package root robustly (works from compiled CLI and tsx ESM):
|
|
641
648
|
// Prefer __dirname when available (CJS), otherwise derive from import.meta.url (ESM).
|
|
@@ -643,9 +650,9 @@ const launchInline = async (root, opts) => {
|
|
|
643
650
|
? __dirname
|
|
644
651
|
: path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
645
652
|
const pkgRoot = packageDirectory.packageDirectorySync({ cwd: here }) ?? process.cwd();
|
|
646
|
-
const
|
|
653
|
+
const { entry } = resolveInlineEntry(pkgRoot);
|
|
647
654
|
const makeTsx = () => {
|
|
648
|
-
const { cmd, args, shell } = resolveTsxCommand(root,
|
|
655
|
+
const { cmd, args, shell } = resolveTsxCommand(root, entry);
|
|
649
656
|
return node_child_process.spawn(cmd, args, {
|
|
650
657
|
cwd: root,
|
|
651
658
|
stdio: 'inherit',
|
package/package.json
CHANGED