@ryanatkn/gro 0.177.0 → 0.177.1
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/run.task.d.ts.map +1 -1
- package/dist/run.task.js +6 -3
- package/package.json +1 -1
- package/src/lib/run.task.ts +7 -3
package/dist/run.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C;;;GAGG;AAEH,cAAc;AACd,eAAO,MAAM,IAAI;;8JAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C;;;GAGG;AAEH,cAAc;AACd,eAAO,MAAM,IAAI;;8JAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+B3B,CAAC"}
|
package/dist/run.task.js
CHANGED
|
@@ -3,7 +3,7 @@ import { styleText as st } from 'node:util';
|
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { TaskError } from "./task.js";
|
|
5
5
|
import { resolve_gro_module_path, spawn_with_loader } from "./gro_helpers.js";
|
|
6
|
-
import { serialize_args } from "./args.js";
|
|
6
|
+
import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
7
7
|
/**
|
|
8
8
|
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
9
9
|
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
@@ -33,8 +33,11 @@ export const task = {
|
|
|
33
33
|
if (!existsSync(path)) {
|
|
34
34
|
throw new TaskError('Cannot find file to run at path: ' + path);
|
|
35
35
|
}
|
|
36
|
-
//
|
|
37
|
-
|
|
36
|
+
// Get args after `--` without requiring a command name.
|
|
37
|
+
// This allows `gro run script.ts -- --help` to pass --help to the script.
|
|
38
|
+
const implicit_args = to_implicit_forwarded_args();
|
|
39
|
+
// Reconstruct argv: positional args + explicit named args + implicit args after --
|
|
40
|
+
const named_argv = serialize_args({ ...forwarded_args, ...implicit_args });
|
|
38
41
|
const full_argv = [...positional_argv, ...named_argv];
|
|
39
42
|
const loader_path = resolve_gro_module_path('loader.js');
|
|
40
43
|
const spawned = await spawn_with_loader(loader_path, path, full_argv);
|
package/package.json
CHANGED
package/src/lib/run.task.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {existsSync} from 'node:fs';
|
|
|
4
4
|
|
|
5
5
|
import {TaskError, type Task} from './task.ts';
|
|
6
6
|
import {resolve_gro_module_path, spawn_with_loader} from './gro_helpers.ts';
|
|
7
|
-
import {serialize_args} from './args.ts';
|
|
7
|
+
import {serialize_args, to_implicit_forwarded_args} from './args.ts';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
@@ -43,8 +43,12 @@ export const task: Task<Args> = {
|
|
|
43
43
|
throw new TaskError('Cannot find file to run at path: ' + path);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
|
|
46
|
+
// Get args after `--` without requiring a command name.
|
|
47
|
+
// This allows `gro run script.ts -- --help` to pass --help to the script.
|
|
48
|
+
const implicit_args = to_implicit_forwarded_args();
|
|
49
|
+
|
|
50
|
+
// Reconstruct argv: positional args + explicit named args + implicit args after --
|
|
51
|
+
const named_argv = serialize_args({...forwarded_args, ...implicit_args});
|
|
48
52
|
const full_argv = [...positional_argv, ...named_argv];
|
|
49
53
|
|
|
50
54
|
const loader_path = resolve_gro_module_path('loader.js');
|