@umijs/plugin-run 4.0.14 → 4.0.17
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/index.js +5 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48,7 +48,8 @@ var src_default = (api) => {
|
|
|
48
48
|
fn: ({ args }) => {
|
|
49
49
|
var _a;
|
|
50
50
|
const globals = ((_a = api.config.run) == null ? void 0 : _a.globals) || [];
|
|
51
|
-
const
|
|
51
|
+
const [scriptFilePath, ...restArgs] = args._;
|
|
52
|
+
const absScriptFilePath = (0, import_path.join)(api.cwd, scriptFilePath);
|
|
52
53
|
const fileName = getFileNameByPath(absScriptFilePath);
|
|
53
54
|
(0, import_assert.default)(fileName, `${absScriptFilePath} is not a valid file`);
|
|
54
55
|
(0, import_assert.default)(/\.([jt])s$/.test(fileName), `${fileName} is not a valid js or ts file`);
|
|
@@ -57,14 +58,14 @@ var src_default = (api) => {
|
|
|
57
58
|
(0, import_fs.writeFileSync)(absTmpFilePath, `${globals.map((item) => `import '${item}'
|
|
58
59
|
`)}import '${absScriptFilePath}';`, "utf-8");
|
|
59
60
|
const tsxPath = getBinPath();
|
|
60
|
-
(0, import_child_process.fork)(tsxPath, [absTmpFilePath], { stdio: "inherit" });
|
|
61
|
+
(0, import_child_process.fork)(tsxPath, [absTmpFilePath, ...restArgs], { stdio: "inherit" });
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
};
|
|
64
65
|
function getBinPath() {
|
|
65
|
-
const pkgPath =
|
|
66
|
+
const pkgPath = import_plugin_utils.resolve.sync("tsx/package.json", { basedir: __dirname });
|
|
66
67
|
const pkgContent = require(pkgPath);
|
|
67
|
-
return (0, import_path.
|
|
68
|
+
return (0, import_path.join)((0, import_path.dirname)(pkgPath), pkgContent.bin);
|
|
68
69
|
}
|
|
69
70
|
function getFileNameByPath(params) {
|
|
70
71
|
return params.split("/").at(-1);
|
package/package.json
CHANGED