esmate 0.0.14 → 0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "esmate",
3
3
  "type": "module",
4
- "version": "0.0.14",
4
+ "version": "0.0.17",
5
5
  "description": "Uncomplicate JavaScript",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1,11 +0,0 @@
1
- export declare const fmt: import("citty").CommandDef<{
2
- check: {
3
- type: "boolean";
4
- description: string;
5
- };
6
- files: {
7
- type: "positional";
8
- description: string;
9
- required: false;
10
- };
11
- }>;
@@ -1,36 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_citty__ from "citty";
2
- import * as __WEBPACK_EXTERNAL_MODULE_consola__ from "consola";
3
- import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
4
- const fmt = (0, __WEBPACK_EXTERNAL_MODULE_citty__.defineCommand)({
5
- meta: {
6
- name: "fmt",
7
- description: "Format source files"
8
- },
9
- args: {
10
- check: {
11
- type: "boolean",
12
- description: "Check if the source files are formatted"
13
- },
14
- files: {
15
- type: "positional",
16
- description: "Files, folders, or globs to format",
17
- required: false
18
- }
19
- },
20
- async run ({ args }) {
21
- try {
22
- const options = [];
23
- const files = args._;
24
- if (args.check) options.push("--check");
25
- else options.push("--write");
26
- options.push("--cache");
27
- options.push("--cache-location");
28
- options.push("'./node_modules/.cache/prettier/.prettier-cache'");
29
- if (0 === files.length) files.push(".");
30
- (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.npx)(`prettier ${options.join(" ")} ${files.join(" ")}`);
31
- } catch (error) {
32
- __WEBPACK_EXTERNAL_MODULE_consola__.consola.error(error);
33
- }
34
- }
35
- });
36
- export { fmt };
@@ -1,11 +0,0 @@
1
- export declare const lint: import("citty").CommandDef<{
2
- fix: {
3
- type: "boolean";
4
- description: string;
5
- };
6
- files: {
7
- type: "positional";
8
- description: string;
9
- required: false;
10
- };
11
- }>;
@@ -1,35 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_citty__ from "citty";
2
- import * as __WEBPACK_EXTERNAL_MODULE_consola__ from "consola";
3
- import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
4
- const lint = (0, __WEBPACK_EXTERNAL_MODULE_citty__.defineCommand)({
5
- meta: {
6
- name: "lint",
7
- description: "Lint JavaScript/TypeScript source code"
8
- },
9
- args: {
10
- fix: {
11
- type: "boolean",
12
- description: "Fix any linting errors for rules that support it"
13
- },
14
- files: {
15
- type: "positional",
16
- description: "Files, folders, or globs to lint",
17
- required: false
18
- }
19
- },
20
- async run (c) {
21
- try {
22
- const options = [];
23
- const files = c.args._;
24
- if (c.args.fix) options.push("--fix");
25
- options.push("--cache");
26
- options.push("--cache-location");
27
- options.push("'./node_modules/.cache/eslint/.eslint-cache'");
28
- if (0 === files.length) files.push(".");
29
- (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.npx)(`eslint ${options.join(" ")} ${files.join(" ")}`);
30
- } catch (error) {
31
- __WEBPACK_EXTERNAL_MODULE_consola__.consola.error(error);
32
- }
33
- }
34
- });
35
- export { lint };
@@ -1,7 +0,0 @@
1
- export declare const task: import("citty").CommandDef<{
2
- task: {
3
- type: "positional";
4
- description: string;
5
- required: false;
6
- };
7
- }>;
@@ -1,30 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_citty__ from "citty";
2
- import * as __WEBPACK_EXTERNAL_MODULE_consola__ from "consola";
3
- import * as __WEBPACK_EXTERNAL_MODULE_es_toolkit_82663681__ from "es-toolkit";
4
- import * as __WEBPACK_EXTERNAL_MODULE__pkg_js_ce8daa14__ from "../pkg.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
6
- const task_task = (0, __WEBPACK_EXTERNAL_MODULE_citty__.defineCommand)({
7
- meta: {
8
- name: "task",
9
- description: "Run a task defined in the package.json"
10
- },
11
- args: {
12
- task: {
13
- type: "positional",
14
- description: "A task to run",
15
- required: false
16
- }
17
- },
18
- async run ({ args }) {
19
- try {
20
- const task = __WEBPACK_EXTERNAL_MODULE__pkg_js_ce8daa14__.pkg.tasks[args.task];
21
- if (!task) return void __WEBPACK_EXTERNAL_MODULE_consola__.consola.error(`Task "${args.task}" not found in package.json`);
22
- const isParallel = (0, __WEBPACK_EXTERNAL_MODULE_es_toolkit_82663681__.isJSONObject)(task);
23
- if (isParallel) (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.execParallelly)(task);
24
- else (0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.execSingly)(task);
25
- } catch (error) {
26
- __WEBPACK_EXTERNAL_MODULE_consola__.consola.error(error);
27
- }
28
- }
29
- });
30
- export { task_task as task };
@@ -1 +0,0 @@
1
- export * from "@esmate/eslint";
@@ -1 +0,0 @@
1
- export * from "@esmate/eslint";
@@ -1 +0,0 @@
1
- export * from "@esmate/prettier";
@@ -1 +0,0 @@
1
- export * from "@esmate/prettier";
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- export declare const meta: {
3
- name: string;
4
- version: string;
5
- description: string;
6
- };
package/dist/index.js DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
- import * as __WEBPACK_EXTERNAL_MODULE_citty__ from "citty";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
4
- import * as __WEBPACK_EXTERNAL_MODULE__commands_fmt_js_e5e4d2b0__ from "./commands/fmt.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__commands_lint_js_e7950167__ from "./commands/lint.js";
6
- import * as __WEBPACK_EXTERNAL_MODULE__commands_task_js_1beabf38__ from "./commands/task.js";
7
- const meta = (()=>{
8
- const pkgPath = new URL("../package.json", import.meta.url);
9
- return JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(pkgPath, "utf-8"));
10
- })();
11
- const main = (0, __WEBPACK_EXTERNAL_MODULE_citty__.defineCommand)({
12
- meta,
13
- subCommands: {
14
- fmt: __WEBPACK_EXTERNAL_MODULE__commands_fmt_js_e5e4d2b0__.fmt,
15
- lint: __WEBPACK_EXTERNAL_MODULE__commands_lint_js_e7950167__.lint,
16
- task: __WEBPACK_EXTERNAL_MODULE__commands_task_js_1beabf38__.task
17
- }
18
- });
19
- (0, __WEBPACK_EXTERNAL_MODULE_citty__.runMain)(main);
20
- export { meta };
package/dist/pkg.d.ts DELETED
@@ -1,8 +0,0 @@
1
- type Task = string | string[] | Record<string, string | string[]>;
2
- declare class Pkg {
3
- path: string;
4
- tasks: Record<string, Task>;
5
- constructor();
6
- }
7
- export declare const pkg: Pkg;
8
- export {};
package/dist/pkg.js DELETED
@@ -1,13 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__ from "find-up";
2
- import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
3
- class Pkg {
4
- path;
5
- tasks;
6
- constructor(){
7
- this.path = (0, __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__.findUpSync)("package.json");
8
- const pkg = (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.readJsonSync)(this.path);
9
- this.tasks = pkg.tasks || {};
10
- }
11
- }
12
- const pkg_pkg = new Pkg();
13
- export { pkg_pkg as pkg };
package/dist/utils.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { JsonValue } from "type-fest";
2
- export declare function execSingly(command: string | string[]): void;
3
- export declare function execParallelly(commands: Record<string, string | string[]>): Promise<void>;
4
- export declare function npx(command: string): void;
5
- export declare function readJsonSync(filePath: string): JsonValue;
package/dist/utils.js DELETED
@@ -1,37 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_concurrently__ from "concurrently";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
5
- function execSingly(command) {
6
- const { env } = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__["default"];
7
- const cmd = Array.isArray(command) ? command.join(" && ") : command;
8
- (0, __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__.spawnSync)(cmd, {
9
- shell: true,
10
- stdio: "inherit",
11
- env
12
- });
13
- }
14
- async function execParallelly(commands) {
15
- const { env } = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__["default"];
16
- const concurrentCommands = [];
17
- for (const [name, command] of Object.entries(commands)){
18
- const cmd = Array.isArray(command) ? command.join(" && ") : command;
19
- concurrentCommands.push({
20
- name,
21
- command: cmd,
22
- env
23
- });
24
- }
25
- await (0, __WEBPACK_EXTERNAL_MODULE_concurrently__["default"])(concurrentCommands, {
26
- handleInput: true,
27
- prefixColors: "auto",
28
- killOthers: "failure"
29
- }).result.then(()=>{}).catch(()=>{});
30
- }
31
- function npx(command) {
32
- execSingly(`npx --yes ${command}`);
33
- }
34
- function readJsonSync(filePath) {
35
- return JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(filePath, "utf-8"));
36
- }
37
- export { execParallelly, execSingly, npx, readJsonSync };