@powerlines/plugin-vite 0.14.124 → 0.14.126

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.
Files changed (141) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/helpers/index.cjs +2 -3
  3. package/dist/helpers/index.d.cts +1 -3
  4. package/dist/helpers/index.d.mts +1 -3
  5. package/dist/helpers/index.mjs +1 -2
  6. package/dist/helpers/unplugin.cjs +11 -2
  7. package/dist/helpers/unplugin.d.cts +6 -2
  8. package/dist/helpers/unplugin.d.mts +6 -2
  9. package/dist/helpers/unplugin.mjs +9 -1
  10. package/dist/index.cjs +9 -170
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +3 -165
  14. package/dist/powerlines/schemas/fs.cjs +226 -0
  15. package/dist/powerlines/schemas/fs.mjs +224 -0
  16. package/dist/powerlines/src/api.cjs +580 -0
  17. package/dist/powerlines/src/api.mjs +578 -0
  18. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -0
  19. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -0
  20. package/dist/powerlines/src/internal/helpers/environment.cjs +52 -0
  21. package/dist/powerlines/src/internal/helpers/environment.mjs +48 -0
  22. package/dist/powerlines/src/internal/helpers/generate-types.cjs +51 -0
  23. package/dist/powerlines/src/internal/helpers/generate-types.mjs +49 -0
  24. package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -0
  25. package/dist/powerlines/src/internal/helpers/hooks.d.cts +48 -0
  26. package/dist/powerlines/src/internal/helpers/hooks.d.mts +50 -0
  27. package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -0
  28. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -0
  29. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -0
  30. package/dist/powerlines/src/internal/helpers/install.cjs +37 -0
  31. package/dist/powerlines/src/internal/helpers/install.mjs +36 -0
  32. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +98 -0
  33. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +94 -0
  34. package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
  35. package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
  36. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
  37. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
  38. package/dist/powerlines/src/lib/build/vite.cjs +74 -0
  39. package/dist/powerlines/src/lib/build/vite.mjs +71 -0
  40. package/dist/powerlines/src/lib/config-file.cjs +79 -0
  41. package/dist/powerlines/src/lib/config-file.mjs +76 -0
  42. package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
  43. package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
  44. package/dist/powerlines/src/lib/contexts/context.cjs +933 -0
  45. package/dist/powerlines/src/lib/contexts/context.mjs +931 -0
  46. package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -0
  47. package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -0
  48. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -0
  49. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -0
  50. package/dist/powerlines/src/lib/entry.cjs +69 -0
  51. package/dist/powerlines/src/lib/entry.mjs +67 -0
  52. package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
  53. package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
  54. package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
  55. package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
  56. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
  57. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
  58. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
  59. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
  60. package/dist/powerlines/src/lib/fs/vfs.cjs +830 -0
  61. package/dist/powerlines/src/lib/fs/vfs.mjs +828 -0
  62. package/dist/powerlines/src/lib/logger.cjs +58 -0
  63. package/dist/powerlines/src/lib/logger.mjs +55 -0
  64. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -0
  65. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -0
  66. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
  67. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
  68. package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
  69. package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
  70. package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -0
  71. package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -0
  72. package/dist/powerlines/src/lib/unplugin/index.cjs +3 -0
  73. package/dist/powerlines/src/lib/unplugin/index.mjs +5 -0
  74. package/dist/powerlines/src/lib/unplugin/plugin.cjs +128 -0
  75. package/dist/powerlines/src/lib/unplugin/plugin.mjs +127 -0
  76. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  77. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  78. package/dist/powerlines/src/lib/utilities/meta.cjs +45 -0
  79. package/dist/powerlines/src/lib/utilities/meta.mjs +41 -0
  80. package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
  81. package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
  82. package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -0
  83. package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -0
  84. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  85. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  86. package/dist/powerlines/src/types/api.d.cts +104 -0
  87. package/dist/powerlines/src/types/api.d.mts +104 -0
  88. package/dist/powerlines/src/types/babel.d.mts +4 -0
  89. package/dist/powerlines/src/types/build.cjs +15 -0
  90. package/dist/powerlines/src/types/build.d.cts +154 -0
  91. package/dist/powerlines/src/types/build.d.mts +154 -0
  92. package/dist/powerlines/src/types/build.mjs +14 -0
  93. package/dist/powerlines/src/types/commands.cjs +16 -0
  94. package/dist/powerlines/src/types/commands.d.cts +8 -0
  95. package/dist/powerlines/src/types/commands.d.mts +9 -0
  96. package/dist/powerlines/src/types/commands.mjs +15 -0
  97. package/dist/powerlines/src/types/config.d.cts +423 -0
  98. package/dist/powerlines/src/types/config.d.mts +425 -0
  99. package/dist/powerlines/src/types/context.d.cts +514 -0
  100. package/dist/powerlines/src/types/context.d.mts +514 -0
  101. package/dist/powerlines/src/types/fs.d.cts +486 -0
  102. package/dist/powerlines/src/types/fs.d.mts +486 -0
  103. package/dist/powerlines/src/types/hooks.d.cts +30 -0
  104. package/dist/powerlines/src/types/hooks.d.mts +30 -0
  105. package/dist/powerlines/src/types/internal.d.cts +58 -0
  106. package/dist/powerlines/src/types/internal.d.mts +58 -0
  107. package/dist/powerlines/src/types/plugin.cjs +32 -0
  108. package/dist/powerlines/src/types/plugin.d.cts +234 -0
  109. package/dist/powerlines/src/types/plugin.d.mts +234 -0
  110. package/dist/powerlines/src/types/plugin.mjs +31 -0
  111. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  112. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  113. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  114. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  115. package/dist/types/index.cjs +0 -2
  116. package/dist/types/index.d.cts +1 -2
  117. package/dist/types/index.d.mts +1 -2
  118. package/dist/types/index.mjs +0 -3
  119. package/dist/types/internal.d.cts +3 -191
  120. package/dist/types/internal.d.mts +3 -191
  121. package/dist/types/plugin.cjs +0 -1
  122. package/dist/types/plugin.d.cts +12 -1
  123. package/dist/types/plugin.d.mts +12 -1
  124. package/dist/types/plugin.mjs +0 -2
  125. package/package.json +5 -5
  126. package/dist/helpers-CmEjzAn_.mjs +0 -1
  127. package/dist/helpers-LF26RHol.cjs +0 -0
  128. package/dist/index-BR1oNnaF.d.cts +0 -1
  129. package/dist/index-DEHBdV_z.d.mts +0 -1
  130. package/dist/index-_wQ5ClJU.d.cts +0 -1
  131. package/dist/index-vkGVyY9v.d.mts +0 -1
  132. package/dist/plugin-Dc12T6ZF.d.mts +0 -1960
  133. package/dist/plugin-jZ9N9Mz-.mjs +0 -1
  134. package/dist/plugin-pBKbb5K9.cjs +0 -0
  135. package/dist/plugin-vkCGh5de.d.cts +0 -1957
  136. package/dist/types-BtDR9wb1.mjs +0 -1
  137. package/dist/types-o3zWarRp.cjs +0 -0
  138. package/dist/unplugin-B3TcDD6I.mjs +0 -4617
  139. package/dist/unplugin-Bv2agFkI.cjs +0 -4661
  140. package/dist/unplugin-D_zrAqRh.d.mts +0 -7
  141. package/dist/unplugin-F1UAxbOS.d.cts +0 -7
@@ -0,0 +1,98 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_tsconfig = require('../../lib/typescript/tsconfig.cjs');
3
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let __stryke_fs_package_fns = require("@stryke/fs/package-fns");
6
+ let chalk = require("chalk");
7
+ chalk = require_rolldown_runtime.__toESM(chalk);
8
+ let __donedeal0_superdiff = require("@donedeal0/superdiff");
9
+ let __stryke_fs_json = require("@stryke/fs/json");
10
+ let __stryke_json_storm_json = require("@stryke/json/storm-json");
11
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
12
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
13
+
14
+ //#region ../powerlines/src/internal/helpers/resolve-tsconfig.ts
15
+ function getTsconfigDtsPath(context) {
16
+ return (0, __stryke_path_join_paths.joinPaths)((0, __stryke_path_file_path_fns.relativePath)((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot), (0, __stryke_path_file_path_fns.findFilePath)(context.dtsPath)), (0, __stryke_path_file_path_fns.findFileName)(context.dtsPath));
17
+ }
18
+ async function resolveTsconfigChanges(context) {
19
+ const tsconfig = require_tsconfig.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
20
+ const tsconfigJson = await (0, __stryke_fs_json.readJsonFile)(require_tsconfig.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig));
21
+ tsconfigJson.compilerOptions ??= {};
22
+ if (context.config.output.dts !== false) {
23
+ const dtsRelativePath = getTsconfigDtsPath(context);
24
+ if (!tsconfigJson.include?.some((filePattern) => require_tsconfig.isIncludeMatchFound(filePattern, [context.dtsPath, dtsRelativePath]))) {
25
+ tsconfigJson.include ??= [];
26
+ tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
27
+ }
28
+ }
29
+ if (!tsconfig.options.lib?.some((lib) => [
30
+ "lib.esnext.d.ts",
31
+ "lib.es2021.d.ts",
32
+ "lib.es2022.d.ts",
33
+ "lib.es2023.d.ts"
34
+ ].includes(lib.toLowerCase()))) {
35
+ tsconfigJson.compilerOptions.lib ??= [];
36
+ tsconfigJson.compilerOptions.lib.push("esnext");
37
+ }
38
+ if (tsconfig.options.esModuleInterop !== true) tsconfigJson.compilerOptions.esModuleInterop = true;
39
+ if (tsconfig.options.isolatedModules !== true) tsconfigJson.compilerOptions.isolatedModules = true;
40
+ if (context.config.build.platform === "node") {
41
+ if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
42
+ tsconfigJson.compilerOptions.types ??= [];
43
+ tsconfigJson.compilerOptions.types.push("node");
44
+ }
45
+ }
46
+ return tsconfigJson;
47
+ }
48
+ async function initializeTsconfig(context) {
49
+ context.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
50
+ if (!(0, __stryke_fs_package_fns.isPackageExists)("typescript")) throw new Error("The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"");
51
+ const tsconfigFilePath = require_tsconfig.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
52
+ context.tsconfig.originalTsconfigJson = await (0, __stryke_fs_json.readJsonFile)(tsconfigFilePath);
53
+ context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
54
+ context.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
55
+ await context.fs.write(tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(context.tsconfig.tsconfigJson));
56
+ context.tsconfig = require_tsconfig.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
57
+ }
58
+ async function resolveTsconfig(context) {
59
+ const updateTsconfigJson = await (0, __stryke_fs_json.readJsonFile)(context.tsconfig.tsconfigFilePath);
60
+ if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) delete updateTsconfigJson.compilerOptions.types;
61
+ const result = (0, __donedeal0_superdiff.getObjectDiff)(context.tsconfig.originalTsconfigJson, updateTsconfigJson, {
62
+ ignoreArrayOrder: true,
63
+ showOnly: {
64
+ statuses: [
65
+ "added",
66
+ "deleted",
67
+ "updated"
68
+ ],
69
+ granularity: "deep"
70
+ }
71
+ });
72
+ const changes = [];
73
+ const getChanges = (difference, property) => {
74
+ if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") if (difference.diff) for (const diff of difference.diff) getChanges(diff, property ? `${property}.${difference.property}` : difference.property);
75
+ else changes.push({
76
+ field: property ? `${property}.${difference.property}` : difference.property,
77
+ status: difference.status,
78
+ previous: difference.status === "added" ? "---" : __stryke_json_storm_json.StormJSON.stringify(difference.previousValue),
79
+ current: difference.status === "deleted" ? "---" : __stryke_json_storm_json.StormJSON.stringify(difference.currentValue)
80
+ });
81
+ };
82
+ for (const diff of result.diff) getChanges(diff);
83
+ if (changes.length > 0) context.log(__storm_software_config_tools_types.LogLevelLabel.WARN, `Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
84
+
85
+ ${changes.map((change, i) => `${chalk.default.bold.whiteBright(`${i + 1}. ${(0, __stryke_string_format_title_case.titleCase)(change.status)} the ${change.field} field: `)}
86
+ ${chalk.default.red(` - Previous: ${change.previous} `)}
87
+ ${chalk.default.green(` - Updated: ${change.current} `)}
88
+ `).join("\n")}
89
+ `);
90
+ await context.fs.write(context.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(updateTsconfigJson));
91
+ context.tsconfig = require_tsconfig.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
92
+ if (!context.tsconfig) throw new Error("Failed to parse the TypeScript configuration file.");
93
+ }
94
+
95
+ //#endregion
96
+ exports.getTsconfigDtsPath = getTsconfigDtsPath;
97
+ exports.initializeTsconfig = initializeTsconfig;
98
+ exports.resolveTsconfig = resolveTsconfig;
@@ -0,0 +1,94 @@
1
+ import { getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound } from "../../lib/typescript/tsconfig.mjs";
2
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import { isPackageExists } from "@stryke/fs/package-fns";
5
+ import chalk from "chalk";
6
+ import { getObjectDiff } from "@donedeal0/superdiff";
7
+ import { readJsonFile } from "@stryke/fs/json";
8
+ import { StormJSON } from "@stryke/json/storm-json";
9
+ import { findFileName, findFilePath, relativePath } from "@stryke/path/file-path-fns";
10
+ import { titleCase } from "@stryke/string-format/title-case";
11
+
12
+ //#region ../powerlines/src/internal/helpers/resolve-tsconfig.ts
13
+ function getTsconfigDtsPath(context) {
14
+ return joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
15
+ }
16
+ async function resolveTsconfigChanges(context) {
17
+ const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
18
+ const tsconfigJson = await readJsonFile(getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig));
19
+ tsconfigJson.compilerOptions ??= {};
20
+ if (context.config.output.dts !== false) {
21
+ const dtsRelativePath = getTsconfigDtsPath(context);
22
+ if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.dtsPath, dtsRelativePath]))) {
23
+ tsconfigJson.include ??= [];
24
+ tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
25
+ }
26
+ }
27
+ if (!tsconfig.options.lib?.some((lib) => [
28
+ "lib.esnext.d.ts",
29
+ "lib.es2021.d.ts",
30
+ "lib.es2022.d.ts",
31
+ "lib.es2023.d.ts"
32
+ ].includes(lib.toLowerCase()))) {
33
+ tsconfigJson.compilerOptions.lib ??= [];
34
+ tsconfigJson.compilerOptions.lib.push("esnext");
35
+ }
36
+ if (tsconfig.options.esModuleInterop !== true) tsconfigJson.compilerOptions.esModuleInterop = true;
37
+ if (tsconfig.options.isolatedModules !== true) tsconfigJson.compilerOptions.isolatedModules = true;
38
+ if (context.config.build.platform === "node") {
39
+ if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
40
+ tsconfigJson.compilerOptions.types ??= [];
41
+ tsconfigJson.compilerOptions.types.push("node");
42
+ }
43
+ }
44
+ return tsconfigJson;
45
+ }
46
+ async function initializeTsconfig(context) {
47
+ context.log(LogLevelLabel.TRACE, "Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
48
+ if (!isPackageExists("typescript")) throw new Error("The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"");
49
+ const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
50
+ context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
51
+ context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
52
+ context.log(LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
53
+ await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
54
+ context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
55
+ }
56
+ async function resolveTsconfig(context) {
57
+ const updateTsconfigJson = await readJsonFile(context.tsconfig.tsconfigFilePath);
58
+ if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) delete updateTsconfigJson.compilerOptions.types;
59
+ const result = getObjectDiff(context.tsconfig.originalTsconfigJson, updateTsconfigJson, {
60
+ ignoreArrayOrder: true,
61
+ showOnly: {
62
+ statuses: [
63
+ "added",
64
+ "deleted",
65
+ "updated"
66
+ ],
67
+ granularity: "deep"
68
+ }
69
+ });
70
+ const changes = [];
71
+ const getChanges = (difference, property) => {
72
+ if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") if (difference.diff) for (const diff of difference.diff) getChanges(diff, property ? `${property}.${difference.property}` : difference.property);
73
+ else changes.push({
74
+ field: property ? `${property}.${difference.property}` : difference.property,
75
+ status: difference.status,
76
+ previous: difference.status === "added" ? "---" : StormJSON.stringify(difference.previousValue),
77
+ current: difference.status === "deleted" ? "---" : StormJSON.stringify(difference.currentValue)
78
+ });
79
+ };
80
+ for (const diff of result.diff) getChanges(diff);
81
+ if (changes.length > 0) context.log(LogLevelLabel.WARN, `Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
82
+
83
+ ${changes.map((change, i) => `${chalk.bold.whiteBright(`${i + 1}. ${titleCase(change.status)} the ${change.field} field: `)}
84
+ ${chalk.red(` - Previous: ${change.previous} `)}
85
+ ${chalk.green(` - Updated: ${change.current} `)}
86
+ `).join("\n")}
87
+ `);
88
+ await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
89
+ context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
90
+ if (!context.tsconfig) throw new Error("Failed to parse the TypeScript configuration file.");
91
+ }
92
+
93
+ //#endregion
94
+ export { getTsconfigDtsPath, initializeTsconfig, resolveTsconfig };
@@ -0,0 +1,43 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let defu = require("defu");
3
+ defu = require_rolldown_runtime.__toESM(defu);
4
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let jiti = require("jiti");
6
+
7
+ //#region ../powerlines/src/internal/helpers/resolver.ts
8
+ /**
9
+ * Create a Jiti resolver for the given workspace and project root.
10
+ *
11
+ * @param options - The options for creating the resolver.
12
+ * @returns A Jiti instance configured for the specified workspace and project root.
13
+ */
14
+ function resolveOptions(options) {
15
+ return (0, defu.default)(options, {
16
+ interopDefault: true,
17
+ fsCache: options.mode !== "development" ? (0, __stryke_path_join_paths.joinPaths)(options.cacheDir, "jiti") : false,
18
+ moduleCache: options.mode !== "development"
19
+ });
20
+ }
21
+ /**
22
+ * Create a Jiti resolver for the given workspace and project root.
23
+ *
24
+ * @param options - The options for creating the resolver.
25
+ * @returns A Jiti instance configured for the specified workspace and project root.
26
+ */
27
+ function createPluginResolver(options) {
28
+ return (0, jiti.createJiti)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, options.projectRoot), resolveOptions({ ...options }));
29
+ }
30
+ /**
31
+ * Create a Jiti resolver for the given workspace and project root.
32
+ *
33
+ * @param options - The options for creating the resolver.
34
+ * @returns A Jiti instance configured for the specified workspace and project root.
35
+ */
36
+ function createResolver(options) {
37
+ const baseResolver = (0, jiti.createJiti)((0, __stryke_path_join_paths.joinPaths)(options.workspaceRoot, options.projectRoot), resolveOptions(options));
38
+ baseResolver.plugin = createPluginResolver(options);
39
+ return baseResolver;
40
+ }
41
+
42
+ //#endregion
43
+ exports.createResolver = createResolver;
@@ -0,0 +1,41 @@
1
+ import defu$1 from "defu";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { createJiti } from "jiti";
4
+
5
+ //#region ../powerlines/src/internal/helpers/resolver.ts
6
+ /**
7
+ * Create a Jiti resolver for the given workspace and project root.
8
+ *
9
+ * @param options - The options for creating the resolver.
10
+ * @returns A Jiti instance configured for the specified workspace and project root.
11
+ */
12
+ function resolveOptions(options) {
13
+ return defu$1(options, {
14
+ interopDefault: true,
15
+ fsCache: options.mode !== "development" ? joinPaths(options.cacheDir, "jiti") : false,
16
+ moduleCache: options.mode !== "development"
17
+ });
18
+ }
19
+ /**
20
+ * Create a Jiti resolver for the given workspace and project root.
21
+ *
22
+ * @param options - The options for creating the resolver.
23
+ * @returns A Jiti instance configured for the specified workspace and project root.
24
+ */
25
+ function createPluginResolver(options) {
26
+ return createJiti(joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({ ...options }));
27
+ }
28
+ /**
29
+ * Create a Jiti resolver for the given workspace and project root.
30
+ *
31
+ * @param options - The options for creating the resolver.
32
+ * @returns A Jiti instance configured for the specified workspace and project root.
33
+ */
34
+ function createResolver(options) {
35
+ const baseResolver = createJiti(joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
36
+ baseResolver.plugin = createPluginResolver(options);
37
+ return baseResolver;
38
+ }
39
+
40
+ //#endregion
41
+ export { createResolver };
@@ -0,0 +1,102 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ require('../entry.cjs');
3
+ let defu = require("defu");
4
+ defu = require_rolldown_runtime.__toESM(defu);
5
+ let __stryke_helpers_omit = require("@stryke/helpers/omit");
6
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
+ let __stryke_path_replace = require("@stryke/path/replace");
8
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
+
11
+ //#region ../powerlines/src/lib/build/esbuild.ts
12
+ const DEFAULT_ESBUILD_CONFIG = {
13
+ target: "esnext",
14
+ platform: "neutral",
15
+ format: "esm",
16
+ write: true,
17
+ minify: true,
18
+ sourcemap: false,
19
+ bundle: true,
20
+ treeShaking: true,
21
+ keepNames: true,
22
+ splitting: true,
23
+ logLevel: "silent"
24
+ };
25
+ /**
26
+ * Resolves the esbuild options.
27
+ *
28
+ * @param context - The build context.
29
+ * @returns The resolved esbuild options.
30
+ */
31
+ function extractESBuildConfig(context) {
32
+ const inject = context.config.build.override.inject ?? context.config.build.inject;
33
+ if (inject && Object.keys(inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
34
+ if (value) if (Array.isArray(value)) {
35
+ if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
36
+ if (value.length === 1) return `
37
+ import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
38
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
39
+ else if (value.length > 1) return `
40
+ import ${value[1] === "*" ? `* as ${(0, __stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, __stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
41
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
42
+ } else if (value.length === 1) return `
43
+ import ${key} from "${value[0]}";
44
+ export { ${key} };`;
45
+ else if (value.length > 1) return `
46
+ import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
47
+ export { ${key} };`;
48
+ } else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
49
+ import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
50
+ export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
51
+ else return `
52
+ import ${key} from "${value}";
53
+ export { ${key} };`;
54
+ return "";
55
+ }).join("\n"));
56
+ return (0, defu.default)({
57
+ alias: context.builtins.reduce((ret, id) => {
58
+ if (!ret[id]) {
59
+ const path = context.fs.ids[id];
60
+ if (path) ret[id] = path;
61
+ }
62
+ return ret;
63
+ }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
64
+ if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
65
+ return ret;
66
+ }, {}) : context.config.build.alias : {}),
67
+ inject: inject && Object.keys(inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
68
+ }, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build.override, [
69
+ "alias",
70
+ "inject",
71
+ "external",
72
+ "noExternal",
73
+ "skipNodeModulesBundle",
74
+ "extensions"
75
+ ]) : {}, context.config.build.variant === "esbuild" ? (0, __stryke_helpers_omit.omit)(context.config.build, [
76
+ "alias",
77
+ "inject",
78
+ "external",
79
+ "noExternal",
80
+ "skipNodeModulesBundle",
81
+ "extensions",
82
+ "variant",
83
+ "override"
84
+ ]) : {}, {
85
+ mainFields: context.config.build.mainFields,
86
+ conditions: context.config.build.conditions,
87
+ define: context.config.build.define,
88
+ resolveExtensions: context.config.build.extensions,
89
+ packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
90
+ format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
91
+ platform: context.config.build.platform,
92
+ treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
93
+ outdir: context.config.output.buildPath,
94
+ tsconfig: context.tsconfig.tsconfigFilePath,
95
+ minify: context.config.mode !== "development",
96
+ metafile: context.config.mode === "development",
97
+ sourcemap: context.config.mode === "development"
98
+ }, DEFAULT_ESBUILD_CONFIG);
99
+ }
100
+
101
+ //#endregion
102
+ exports.extractESBuildConfig = extractESBuildConfig;
@@ -0,0 +1,100 @@
1
+ import "../entry.mjs";
2
+ import defu$1 from "defu";
3
+ import { omit } from "@stryke/helpers/omit";
4
+ import { joinPaths } from "@stryke/path/join-paths";
5
+ import { replaceExtension, replacePath } from "@stryke/path/replace";
6
+ import { camelCase } from "@stryke/string-format/camel-case";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
+
9
+ //#region ../powerlines/src/lib/build/esbuild.ts
10
+ const DEFAULT_ESBUILD_CONFIG = {
11
+ target: "esnext",
12
+ platform: "neutral",
13
+ format: "esm",
14
+ write: true,
15
+ minify: true,
16
+ sourcemap: false,
17
+ bundle: true,
18
+ treeShaking: true,
19
+ keepNames: true,
20
+ splitting: true,
21
+ logLevel: "silent"
22
+ };
23
+ /**
24
+ * Resolves the esbuild options.
25
+ *
26
+ * @param context - The build context.
27
+ * @returns The resolved esbuild options.
28
+ */
29
+ function extractESBuildConfig(context) {
30
+ const inject = context.config.build.override.inject ?? context.config.build.inject;
31
+ if (inject && Object.keys(inject).length > 0) context.fs.writeSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js"), Object.entries(inject).map(([key, value]) => {
32
+ if (value) if (Array.isArray(value)) {
33
+ if (camelCase(key) !== key) {
34
+ if (value.length === 1) return `
35
+ import ${camelCase(key)} from "${value[0]}";
36
+ export { ${camelCase(key)} as "${key}" }`;
37
+ else if (value.length > 1) return `
38
+ import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
39
+ export { ${camelCase(key)} as "${key}" }`;
40
+ } else if (value.length === 1) return `
41
+ import ${key} from "${value[0]}";
42
+ export { ${key} };`;
43
+ else if (value.length > 1) return `
44
+ import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
45
+ export { ${key} };`;
46
+ } else if (camelCase(key) !== key) return `
47
+ import ${camelCase(key)} from "${value[0]}";
48
+ export { ${camelCase(key)} as "${key}" }`;
49
+ else return `
50
+ import ${key} from "${value}";
51
+ export { ${key} };`;
52
+ return "";
53
+ }).join("\n"));
54
+ return defu$1({
55
+ alias: context.builtins.reduce((ret, id) => {
56
+ if (!ret[id]) {
57
+ const path = context.fs.ids[id];
58
+ if (path) ret[id] = path;
59
+ }
60
+ return ret;
61
+ }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
62
+ if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
63
+ return ret;
64
+ }, {}) : context.config.build.alias : {}),
65
+ inject: inject && Object.keys(inject).length > 0 ? [joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")] : void 0
66
+ }, context.config.build.variant === "esbuild" ? omit(context.config.build.override, [
67
+ "alias",
68
+ "inject",
69
+ "external",
70
+ "noExternal",
71
+ "skipNodeModulesBundle",
72
+ "extensions"
73
+ ]) : {}, context.config.build.variant === "esbuild" ? omit(context.config.build, [
74
+ "alias",
75
+ "inject",
76
+ "external",
77
+ "noExternal",
78
+ "skipNodeModulesBundle",
79
+ "extensions",
80
+ "variant",
81
+ "override"
82
+ ]) : {}, {
83
+ mainFields: context.config.build.mainFields,
84
+ conditions: context.config.build.conditions,
85
+ define: context.config.build.define,
86
+ resolveExtensions: context.config.build.extensions,
87
+ packages: context.config.build.skipNodeModulesBundle ? "external" : context.config.build.variant === "esbuild" ? context.config.build.packages : void 0,
88
+ format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
89
+ platform: context.config.build.platform,
90
+ treeShaking: Boolean(context.config.build?.treeshake) || context.config.build?.treeShaking,
91
+ outdir: context.config.output.buildPath,
92
+ tsconfig: context.tsconfig.tsconfigFilePath,
93
+ minify: context.config.mode !== "development",
94
+ metafile: context.config.mode === "development",
95
+ sourcemap: context.config.mode === "development"
96
+ }, DEFAULT_ESBUILD_CONFIG);
97
+ }
98
+
99
+ //#endregion
100
+ export { extractESBuildConfig };
@@ -0,0 +1,74 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_esbuild = require('./esbuild.cjs');
3
+ let defu = require("defu");
4
+ defu = require_rolldown_runtime.__toESM(defu);
5
+ let __stryke_helpers_omit = require("@stryke/helpers/omit");
6
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
+
8
+ //#region ../powerlines/src/lib/build/vite.ts
9
+ const DEFAULT_VITE_CONFIG = {
10
+ resolve: { extensions: [
11
+ ".mjs",
12
+ ".js",
13
+ ".mts",
14
+ ".ts",
15
+ ".jsx",
16
+ ".tsx",
17
+ ".json"
18
+ ] },
19
+ json: { stringify: true },
20
+ logLevel: "silent",
21
+ clearScreen: true
22
+ };
23
+ /**
24
+ * Resolves the options for [vite](https://vitejs.dev/).
25
+ *
26
+ * @param context - The build context.
27
+ * @returns The resolved options.
28
+ */
29
+ function extractViteConfig(context) {
30
+ return (0, defu.default)({ resolve: {
31
+ alias: context.builtins.reduce((ret, id) => {
32
+ if (!ret.find((e) => e.find === id)) {
33
+ const path = context.fs.ids[id];
34
+ if (path) ret.push({
35
+ find: id,
36
+ replacement: path
37
+ });
38
+ }
39
+ return ret;
40
+ }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
41
+ if (!ret.find((e) => e.find === id)) ret.push({
42
+ find: id,
43
+ replacement: path
44
+ });
45
+ return ret;
46
+ }, []) : []),
47
+ dedupe: context.config.build.dedupe,
48
+ mainFields: context.config.build.mainFields,
49
+ conditions: context.config.build.conditions,
50
+ extensions: context.config.build.extensions
51
+ } }, context.config.build.variant === "vite" ? (0, defu.default)(context.config.build.override ?? {}, { optimizeDeps: context.config.build.override?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.override?.extensions } }) : {}, context.config.build.variant === "vite" ? (0, defu.default)((0, __stryke_helpers_omit.omit)(context.config.build, ["override", "variant"]), { optimizeDeps: context.config.build?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.extensions } }) : {}, {
52
+ keepProcessEnv: context.config.build.keepProcessEnv,
53
+ define: context.config.build.define,
54
+ rootDir: context.config.sourceRoot,
55
+ platform: context.config.build.platform,
56
+ mode: context.config.mode === "development" ? "development" : "production",
57
+ cacheDir: (0, __stryke_path_join_paths.joinPaths)(context.cachePath, "vite"),
58
+ build: {
59
+ minify: context.config.mode !== "development",
60
+ metafile: context.config.mode === "development",
61
+ sourcemap: context.config.mode === "development",
62
+ outDir: context.config.output.buildPath,
63
+ tsconfig: context.tsconfig.tsconfigFilePath,
64
+ tsconfigRaw: context.tsconfig.tsconfigJson
65
+ },
66
+ esbuild: require_esbuild.extractESBuildConfig(context),
67
+ logLevel: context.config.logLevel ?? void 0,
68
+ envDir: context.config.projectRoot
69
+ }, DEFAULT_VITE_CONFIG);
70
+ }
71
+
72
+ //#endregion
73
+ exports.DEFAULT_VITE_CONFIG = DEFAULT_VITE_CONFIG;
74
+ exports.extractViteConfig = extractViteConfig;
@@ -0,0 +1,71 @@
1
+ import { extractESBuildConfig } from "./esbuild.mjs";
2
+ import defu$1 from "defu";
3
+ import { omit } from "@stryke/helpers/omit";
4
+ import { joinPaths } from "@stryke/path/join-paths";
5
+
6
+ //#region ../powerlines/src/lib/build/vite.ts
7
+ const DEFAULT_VITE_CONFIG = {
8
+ resolve: { extensions: [
9
+ ".mjs",
10
+ ".js",
11
+ ".mts",
12
+ ".ts",
13
+ ".jsx",
14
+ ".tsx",
15
+ ".json"
16
+ ] },
17
+ json: { stringify: true },
18
+ logLevel: "silent",
19
+ clearScreen: true
20
+ };
21
+ /**
22
+ * Resolves the options for [vite](https://vitejs.dev/).
23
+ *
24
+ * @param context - The build context.
25
+ * @returns The resolved options.
26
+ */
27
+ function extractViteConfig(context) {
28
+ return defu$1({ resolve: {
29
+ alias: context.builtins.reduce((ret, id) => {
30
+ if (!ret.find((e) => e.find === id)) {
31
+ const path = context.fs.ids[id];
32
+ if (path) ret.push({
33
+ find: id,
34
+ replacement: path
35
+ });
36
+ }
37
+ return ret;
38
+ }, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
39
+ if (!ret.find((e) => e.find === id)) ret.push({
40
+ find: id,
41
+ replacement: path
42
+ });
43
+ return ret;
44
+ }, []) : []),
45
+ dedupe: context.config.build.dedupe,
46
+ mainFields: context.config.build.mainFields,
47
+ conditions: context.config.build.conditions,
48
+ extensions: context.config.build.extensions
49
+ } }, context.config.build.variant === "vite" ? defu$1(context.config.build.override ?? {}, { optimizeDeps: context.config.build.override?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.override?.extensions } }) : {}, context.config.build.variant === "vite" ? defu$1(omit(context.config.build, ["override", "variant"]), { optimizeDeps: context.config.build?.optimizeDeps ?? {} }, { optimizeDeps: { extensions: context.config.build.extensions } }) : {}, {
50
+ keepProcessEnv: context.config.build.keepProcessEnv,
51
+ define: context.config.build.define,
52
+ rootDir: context.config.sourceRoot,
53
+ platform: context.config.build.platform,
54
+ mode: context.config.mode === "development" ? "development" : "production",
55
+ cacheDir: joinPaths(context.cachePath, "vite"),
56
+ build: {
57
+ minify: context.config.mode !== "development",
58
+ metafile: context.config.mode === "development",
59
+ sourcemap: context.config.mode === "development",
60
+ outDir: context.config.output.buildPath,
61
+ tsconfig: context.tsconfig.tsconfigFilePath,
62
+ tsconfigRaw: context.tsconfig.tsconfigJson
63
+ },
64
+ esbuild: extractESBuildConfig(context),
65
+ logLevel: context.config.logLevel ?? void 0,
66
+ envDir: context.config.projectRoot
67
+ }, DEFAULT_VITE_CONFIG);
68
+ }
69
+
70
+ //#endregion
71
+ export { DEFAULT_VITE_CONFIG, extractViteConfig };