@powerlines/core 0.48.54 → 0.48.56

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.
@@ -21,7 +21,7 @@ declare const LogCategories: {
21
21
  readonly BABEL: "babel";
22
22
  readonly COMMUNICATION: "communication";
23
23
  };
24
- declare const LOG_CATEGORIES_ARRAY: ("plugins" | "general" | "fs" | "performance" | "config" | "hooks" | "schema" | "env" | "rpc" | "babel" | "communication")[];
24
+ declare const LOG_CATEGORIES_ARRAY: ("config" | "fs" | "plugins" | "general" | "performance" | "hooks" | "schema" | "env" | "rpc" | "babel" | "communication")[];
25
25
  declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config", "plugins", "hooks", "schema", "env", "rpc", "communication", "babel"];
26
26
  declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
27
27
  readonly general: "debug";
@@ -21,7 +21,7 @@ declare const LogCategories: {
21
21
  readonly BABEL: "babel";
22
22
  readonly COMMUNICATION: "communication";
23
23
  };
24
- declare const LOG_CATEGORIES_ARRAY: ("plugins" | "general" | "fs" | "performance" | "config" | "hooks" | "schema" | "env" | "rpc" | "babel" | "communication")[];
24
+ declare const LOG_CATEGORIES_ARRAY: ("config" | "fs" | "plugins" | "general" | "performance" | "hooks" | "schema" | "env" | "rpc" | "babel" | "communication")[];
25
25
  declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config", "plugins", "hooks", "schema", "env", "rpc", "communication", "babel"];
26
26
  declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
27
27
  readonly general: "debug";
@@ -3,8 +3,8 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_path_append = require("@stryke/path/append");
4
4
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
5
5
  let defu = require("defu");
6
- let _storm_software_prettier_config = require("@storm-software/prettier/config");
7
- _storm_software_prettier_config = require_runtime.__toESM(_storm_software_prettier_config, 1);
6
+ let _storm_software_prettier = require("@storm-software/prettier");
7
+ _storm_software_prettier = require_runtime.__toESM(_storm_software_prettier, 1);
8
8
  let _stryke_fs_list_files = require("@stryke/fs/list-files");
9
9
  let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
10
10
  let prettier = require("prettier");
@@ -29,10 +29,10 @@ async function format(context, path, data, force = false) {
29
29
  try {
30
30
  resolvedConfig = await (0, prettier.resolveConfig)(path);
31
31
  } catch {}
32
- resolvedConfig ??= _storm_software_prettier_config.default;
32
+ resolvedConfig ??= _storm_software_prettier.default;
33
33
  if (resolvedConfig) code = await (0, prettier.format)(data, (0, defu.defu)({
34
- absolutePath: path,
35
- ...resolvedConfig
34
+ ...resolvedConfig,
35
+ filepath: path
36
36
  }, (0, _stryke_path_file_path_fns.findFileExtension)(path) === "ts" || (0, _stryke_path_file_path_fns.findFileExtension)(path) === "tsx" ? { plugins: [prettier_plugin_organize_imports.default] } : {}));
37
37
  } catch (error) {
38
38
  throw new Error(`Failed to format file at ${path} with Prettier: ${error.message}`, { cause: error });
@@ -1,7 +1,7 @@
1
1
  import { appendPath } from "@stryke/path/append";
2
2
  import { findFileExtension } from "@stryke/path/file-path-fns";
3
3
  import { defu as defu$1 } from "defu";
4
- import prettierConfig from "@storm-software/prettier/config";
4
+ import prettierConfig from "@storm-software/prettier";
5
5
  import { listFiles } from "@stryke/fs/list-files";
6
6
  import { isParentPath } from "@stryke/path/is-parent-path";
7
7
  import { format as format$1, resolveConfig } from "prettier";
@@ -27,8 +27,8 @@ async function format(context, path, data, force = false) {
27
27
  } catch {}
28
28
  resolvedConfig ??= prettierConfig;
29
29
  if (resolvedConfig) code = await format$1(data, defu$1({
30
- absolutePath: path,
31
- ...resolvedConfig
30
+ ...resolvedConfig,
31
+ filepath: path
32
32
  }, findFileExtension(path) === "ts" || findFileExtension(path) === "tsx" ? { plugins: [importsPlugin] } : {}));
33
33
  } catch (error) {
34
34
  throw new Error(`Failed to format file at ${path} with Prettier: ${error.message}`, { cause: error });
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","names":["prettier","defu"],"sources":["../../../src/lib/utilities/format.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport prettierConfig from \"@storm-software/prettier/config\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { defu } from \"defu\";\nimport { Options, format as prettier, resolveConfig } from \"prettier\";\nimport importsPlugin from \"prettier-plugin-organize-imports\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n ((context.config.output.copy &&\n isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) ||\n isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n return data;\n }\n\n let code = data;\n try {\n let resolvedConfig = null as Options | null;\n try {\n resolvedConfig = await resolveConfig(path);\n } catch {\n // If resolving the config fails, we can ignore it and use the default Prettier settings\n }\n\n // If no config was found, we can use the default Prettier settings\n resolvedConfig ??= prettierConfig;\n\n if (resolvedConfig) {\n code = await prettier(\n data,\n defu(\n {\n absolutePath: path,\n ...resolvedConfig\n },\n findFileExtension(path) === \"ts\" || findFileExtension(path) === \"tsx\"\n ? { plugins: [importsPlugin] }\n : {}\n )\n );\n }\n } catch (error) {\n throw new Error(\n `Failed to format file at ${path} with Prettier: ${\n (error as Error).message\n }`,\n { cause: error }\n );\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !context.config.output.copy ||\n (!isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n ) &&\n !isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n (!context.config.output.copy ||\n !isParentPath(\n file,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) &&\n !isParentPath(\n file,\n appendPath(context.config.output.path, context.config.cwd)\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;CACjB,IACE,CAAC,UACC,QAAQ,OAAO,OAAO,QACtB,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACA,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,IAEF,OAAO;CAGT,IAAI,OAAO;CACX,IAAI;EACF,IAAI,iBAAiB;EACrB,IAAI;GACF,iBAAiB,MAAM,cAAc,IAAI;EAC3C,QAAQ,CAER;EAGA,mBAAmB;EAEnB,IAAI,gBACF,OAAO,MAAMA,SACX,MACAC,OACE;GACE,cAAc;GACd,GAAG;EACL,GACA,kBAAkB,IAAI,MAAM,QAAQ,kBAAkB,IAAI,MAAM,QAC5D,EAAE,SAAS,CAAC,aAAa,EAAE,IAC3B,CAAC,CACP,CACF;CAEJ,SAAS,OAAO;EACd,MAAM,IAAI,MACR,4BAA4B,KAAK,kBAC9B,MAAgB,WAEnB,EAAE,OAAO,MAAM,CACjB;CACF;CAEA,OAAO;AACT;;;;;;;;AASA,eAAsB,aAAa,SAAkB,MAAc;CACjE,IACE,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACA,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACE,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GAEF,MAAM,QAAQ,YACX,MAAM,UAAU,IAAI,EAAC,CAAE,IAAI,OAAM,SAAQ;EACxC,KACG,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,MACF,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GACA;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,IAAI;GACvC,IAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,IAAI;IAElD,OAAO,QAAQ,GAAG,MAAM,MAAM,SAAS;GACzC;EACF;CACF,CAAC,CACH;AAEJ"}
1
+ {"version":3,"file":"format.mjs","names":["prettier","defu"],"sources":["../../../src/lib/utilities/format.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n 🗲 Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport prettierConfig from \"@storm-software/prettier\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { defu } from \"defu\";\nimport { Options, format as prettier, resolveConfig } from \"prettier\";\nimport importsPlugin from \"prettier-plugin-organize-imports\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n ((context.config.output.copy &&\n isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) ||\n isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n return data;\n }\n\n let code = data;\n try {\n let resolvedConfig = null as Options | null;\n try {\n resolvedConfig = await resolveConfig(path);\n } catch {\n // If resolving the config fails, we can ignore it and use the default Prettier settings\n }\n\n // If no config was found, we can use the default Prettier settings\n resolvedConfig ??= prettierConfig as Options;\n\n if (resolvedConfig) {\n code = await prettier(\n data,\n defu(\n {\n ...resolvedConfig,\n filepath: path\n },\n findFileExtension(path) === \"ts\" || findFileExtension(path) === \"tsx\"\n ? { plugins: [importsPlugin] }\n : {}\n )\n );\n }\n } catch (error) {\n throw new Error(\n `Failed to format file at ${path} with Prettier: ${\n (error as Error).message\n }`,\n { cause: error }\n );\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !context.config.output.copy ||\n (!isParentPath(\n path,\n appendPath(context.config.output.copy.path, context.config.cwd)\n ) &&\n !isParentPath(\n path,\n appendPath(context.config.output.path, context.config.cwd)\n ))\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n (!context.config.output.copy ||\n !isParentPath(\n file,\n appendPath(context.config.output.copy.path, context.config.cwd)\n )) &&\n !isParentPath(\n file,\n appendPath(context.config.output.path, context.config.cwd)\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;CACjB,IACE,CAAC,UACC,QAAQ,OAAO,OAAO,QACtB,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACA,aACE,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,IAEF,OAAO;CAGT,IAAI,OAAO;CACX,IAAI;EACF,IAAI,iBAAiB;EACrB,IAAI;GACF,iBAAiB,MAAM,cAAc,IAAI;EAC3C,QAAQ,CAER;EAGA,mBAAmB;EAEnB,IAAI,gBACF,OAAO,MAAMA,SACX,MACAC,OACE;GACE,GAAG;GACH,UAAU;EACZ,GACA,kBAAkB,IAAI,MAAM,QAAQ,kBAAkB,IAAI,MAAM,QAC5D,EAAE,SAAS,CAAC,aAAa,EAAE,IAC3B,CAAC,CACP,CACF;CAEJ,SAAS,OAAO;EACd,MAAM,IAAI,MACR,4BAA4B,KAAK,kBAC9B,MAAgB,WAEnB,EAAE,OAAO,MAAM,CACjB;CACF;CAEA,OAAO;AACT;;;;;;;;AASA,eAAsB,aAAa,SAAkB,MAAc;CACjE,IACE,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACA,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,KACE,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GAEF,MAAM,QAAQ,YACX,MAAM,UAAU,IAAI,EAAC,CAAE,IAAI,OAAM,SAAQ;EACxC,KACG,CAAC,QAAQ,OAAO,OAAO,QACtB,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,KAAK,MAAM,QAAQ,OAAO,GAAG,CAChE,MACF,CAAC,aACC,MACA,WAAW,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,GAAG,CAC3D,GACA;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,IAAI;GACvC,IAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,IAAI;IAElD,OAAO,QAAQ,GAAG,MAAM,MAAM,SAAS;GACzC;EACF;CACF,CAAC,CACH;AAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.48.54",
3
+ "version": "0.48.56",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -329,7 +329,7 @@
329
329
  "@rolldown/pluginutils": "^1.0.1",
330
330
  "@storm-software/config": "^1.137.85",
331
331
  "@storm-software/config-tools": "^1.190.53",
332
- "@storm-software/prettier": "^0.59.105",
332
+ "@storm-software/prettier": "^0.59.106",
333
333
  "@stryke/capnp": "^0.12.111",
334
334
  "@stryke/convert": "^0.7.15",
335
335
  "@stryke/env": "^0.20.102",
@@ -378,5 +378,5 @@
378
378
  "undici-types": "^7.27.2"
379
379
  },
380
380
  "publishConfig": { "access": "public" },
381
- "gitHead": "2667413150461f29ad1786cefd8e00137862aa6c"
381
+ "gitHead": "5ef45196d8c43e50c12d7000d1faafd27926cad0"
382
382
  }