@powerlines/plugin-webpack 0.5.132 → 0.5.133

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 (130) 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 +8 -50
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +3 -46
  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.mjs +61 -0
  26. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -0
  27. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -0
  28. package/dist/powerlines/src/internal/helpers/install.cjs +37 -0
  29. package/dist/powerlines/src/internal/helpers/install.mjs +36 -0
  30. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +98 -0
  31. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +94 -0
  32. package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
  33. package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
  34. package/dist/powerlines/src/lib/build/webpack.cjs +47 -0
  35. package/dist/powerlines/src/lib/build/webpack.mjs +45 -0
  36. package/dist/powerlines/src/lib/config-file.cjs +79 -0
  37. package/dist/powerlines/src/lib/config-file.mjs +76 -0
  38. package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
  39. package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
  40. package/dist/powerlines/src/lib/contexts/context.cjs +933 -0
  41. package/dist/powerlines/src/lib/contexts/context.mjs +931 -0
  42. package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -0
  43. package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -0
  44. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -0
  45. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -0
  46. package/dist/powerlines/src/lib/entry.cjs +69 -0
  47. package/dist/powerlines/src/lib/entry.mjs +67 -0
  48. package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
  49. package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
  50. package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
  51. package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
  52. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
  53. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
  54. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
  55. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
  56. package/dist/powerlines/src/lib/fs/vfs.cjs +830 -0
  57. package/dist/powerlines/src/lib/fs/vfs.mjs +828 -0
  58. package/dist/powerlines/src/lib/logger.cjs +58 -0
  59. package/dist/powerlines/src/lib/logger.mjs +55 -0
  60. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -0
  61. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -0
  62. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
  63. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
  64. package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
  65. package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
  66. package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -0
  67. package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -0
  68. package/dist/powerlines/src/lib/unplugin/index.cjs +3 -0
  69. package/dist/powerlines/src/lib/unplugin/index.mjs +5 -0
  70. package/dist/powerlines/src/lib/unplugin/plugin.cjs +128 -0
  71. package/dist/powerlines/src/lib/unplugin/plugin.mjs +127 -0
  72. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  73. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  74. package/dist/powerlines/src/lib/utilities/meta.cjs +45 -0
  75. package/dist/powerlines/src/lib/utilities/meta.mjs +41 -0
  76. package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
  77. package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
  78. package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -0
  79. package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -0
  80. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  81. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  82. package/dist/powerlines/src/types/babel.d.mts +4 -0
  83. package/dist/powerlines/src/types/build.cjs +15 -0
  84. package/dist/powerlines/src/types/build.d.cts +149 -0
  85. package/dist/powerlines/src/types/build.d.mts +149 -0
  86. package/dist/powerlines/src/types/build.mjs +14 -0
  87. package/dist/powerlines/src/types/commands.cjs +16 -0
  88. package/dist/powerlines/src/types/commands.d.cts +8 -0
  89. package/dist/powerlines/src/types/commands.d.mts +9 -0
  90. package/dist/powerlines/src/types/commands.mjs +15 -0
  91. package/dist/powerlines/src/types/config.d.cts +377 -0
  92. package/dist/powerlines/src/types/config.d.mts +378 -0
  93. package/dist/powerlines/src/types/context.d.cts +403 -0
  94. package/dist/powerlines/src/types/context.d.mts +405 -0
  95. package/dist/powerlines/src/types/fs.d.cts +486 -0
  96. package/dist/powerlines/src/types/fs.d.mts +486 -0
  97. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  98. package/dist/powerlines/src/types/plugin.cjs +32 -0
  99. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  100. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  101. package/dist/powerlines/src/types/plugin.mjs +31 -0
  102. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  103. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  104. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  105. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  106. package/dist/types/index.cjs +0 -2
  107. package/dist/types/index.d.cts +1 -2
  108. package/dist/types/index.d.mts +1 -2
  109. package/dist/types/index.mjs +0 -3
  110. package/dist/types/plugin.cjs +0 -1
  111. package/dist/types/plugin.d.cts +12 -1
  112. package/dist/types/plugin.d.mts +12 -1
  113. package/dist/types/plugin.mjs +0 -2
  114. package/package.json +5 -5
  115. package/dist/helpers-B15z10jN.mjs +0 -1
  116. package/dist/helpers-LF26RHol.cjs +0 -0
  117. package/dist/index-9iG2qHLe.d.mts +0 -1
  118. package/dist/index-D4ELpJXS.d.cts +0 -1
  119. package/dist/index-D6CnpA_r.d.cts +0 -1
  120. package/dist/index-DL0uimUT.d.mts +0 -1
  121. package/dist/plugin-C5bG6Zu0.d.mts +0 -1772
  122. package/dist/plugin-Cl1J-dKa.d.cts +0 -1769
  123. package/dist/plugin-ifZVa20V.mjs +0 -1
  124. package/dist/plugin-pBKbb5K9.cjs +0 -0
  125. package/dist/types-U3zd8PTP.mjs +0 -1
  126. package/dist/types-o3zWarRp.cjs +0 -0
  127. package/dist/unplugin-Bo9KoKSB.d.cts +0 -7
  128. package/dist/unplugin-Ct4wZxE5.d.mts +0 -7
  129. package/dist/unplugin-GJmHohOE.mjs +0 -4617
  130. package/dist/unplugin-bKYETUU8.cjs +0 -4661
@@ -0,0 +1,58 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
3
+ let chalk = require("chalk");
4
+ chalk = require_rolldown_runtime.__toESM(chalk);
5
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
+ let __storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
7
+ let __storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
8
+ let __stryke_helpers_noop = require("@stryke/helpers/noop");
9
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
10
+
11
+ //#region ../powerlines/src/lib/logger.ts
12
+ /**
13
+ * Create a logging function with a specific name and options.
14
+ *
15
+ * @param name - The name of the logging function.
16
+ * @param options - The options to configure the logging function.
17
+ * @returns A logging function.
18
+ */
19
+ const createLog = (name, options = {}) => {
20
+ const logLevel = options.logLevel === null ? __storm_software_config_tools_types.LogLevelLabel.SILENT : options.logLevel || __storm_software_config_tools_types.LogLevelLabel.INFO;
21
+ if (logLevel === __storm_software_config_tools_types.LogLevelLabel.SILENT) return __stryke_helpers_noop.noop;
22
+ if (options.customLogger) return options.customLogger;
23
+ return (type, ...args) => (0, __storm_software_config_tools_logger.getLogFn)((0, __storm_software_config_tools_logger.getLogLevel)(type), {
24
+ ...options,
25
+ logLevel
26
+ })(`${chalk.default.bold.hex((0, __storm_software_config_tools_utilities_colors.getColor)("brand", options))(`${name ? (0, __stryke_string_format_kebab_case.kebabCase)(name) : ""}${options.name ? `${name ? chalk.default.gray(" > ") : ""}${(0, __stryke_string_format_kebab_case.kebabCase)(options.name)}` : ""}${chalk.default.gray(" > ")}`)}${args.join(" ")} `.trim());
27
+ };
28
+ const BADGE_COLORS = [
29
+ "#00A0DD",
30
+ "#6FCE4E",
31
+ "#FBBF24",
32
+ "#F43F5E",
33
+ "#3B82F6",
34
+ "#A855F7",
35
+ "#469592",
36
+ "#288EDF",
37
+ "#D8B4FE",
38
+ "#10B981",
39
+ "#EF4444",
40
+ "#F0EC56",
41
+ "#F472B6",
42
+ "#22D3EE",
43
+ "#EAB308",
44
+ "#84CC16",
45
+ "#F87171",
46
+ "#0EA5E9",
47
+ "#D946EF",
48
+ "#FACC15",
49
+ "#34D399",
50
+ "#8B5CF6"
51
+ ];
52
+ const extendLog = (logFn, name) => {
53
+ return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
54
+ };
55
+
56
+ //#endregion
57
+ exports.createLog = createLog;
58
+ exports.extendLog = extendLog;
@@ -0,0 +1,55 @@
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import chalk from "chalk";
3
+ import { titleCase } from "@stryke/string-format/title-case";
4
+ import { getLogFn, getLogLevel } from "@storm-software/config-tools/logger";
5
+ import { getColor } from "@storm-software/config-tools/utilities/colors";
6
+ import { noop } from "@stryke/helpers/noop";
7
+ import { kebabCase } from "@stryke/string-format/kebab-case";
8
+
9
+ //#region ../powerlines/src/lib/logger.ts
10
+ /**
11
+ * Create a logging function with a specific name and options.
12
+ *
13
+ * @param name - The name of the logging function.
14
+ * @param options - The options to configure the logging function.
15
+ * @returns A logging function.
16
+ */
17
+ const createLog = (name, options = {}) => {
18
+ const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
19
+ if (logLevel === LogLevelLabel.SILENT) return noop;
20
+ if (options.customLogger) return options.customLogger;
21
+ return (type, ...args) => getLogFn(getLogLevel(type), {
22
+ ...options,
23
+ logLevel
24
+ })(`${chalk.bold.hex(getColor("brand", options))(`${name ? kebabCase(name) : ""}${options.name ? `${name ? chalk.gray(" > ") : ""}${kebabCase(options.name)}` : ""}${chalk.gray(" > ")}`)}${args.join(" ")} `.trim());
25
+ };
26
+ const BADGE_COLORS = [
27
+ "#00A0DD",
28
+ "#6FCE4E",
29
+ "#FBBF24",
30
+ "#F43F5E",
31
+ "#3B82F6",
32
+ "#A855F7",
33
+ "#469592",
34
+ "#288EDF",
35
+ "#D8B4FE",
36
+ "#10B981",
37
+ "#EF4444",
38
+ "#F0EC56",
39
+ "#F472B6",
40
+ "#22D3EE",
41
+ "#EAB308",
42
+ "#84CC16",
43
+ "#F87171",
44
+ "#0EA5E9",
45
+ "#D946EF",
46
+ "#FACC15",
47
+ "#34D399",
48
+ "#8B5CF6"
49
+ ];
50
+ const extendLog = (logFn, name) => {
51
+ return (type, ...args) => logFn(type, ` ${chalk.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
52
+ };
53
+
54
+ //#endregion
55
+ export { createLog, extendLog };
@@ -0,0 +1,104 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
3
+ let defu = require("defu");
4
+ defu = require_rolldown_runtime.__toESM(defu);
5
+ let ts_morph = require("ts-morph");
6
+
7
+ //#region ../powerlines/src/lib/typescript/ts-morph.ts
8
+ var VirtualFileSystemHost = class extends ts_morph.InMemoryFileSystemHost {
9
+ #context;
10
+ constructor(context) {
11
+ super();
12
+ this.#context = context;
13
+ }
14
+ deleteSync(path) {
15
+ this.#context.fs.removeSync(path);
16
+ }
17
+ readDirSync(dirPath) {
18
+ if (!this.#context.fs.isDirectorySync(dirPath)) return [];
19
+ return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
20
+ const fullPath = this.#context.fs.resolveSync(entry);
21
+ if (fullPath) ret.push({
22
+ name: entry,
23
+ isDirectory: this.#context.fs.isDirectorySync(fullPath),
24
+ isFile: this.#context.fs.isFileSync(fullPath),
25
+ isSymlink: false
26
+ });
27
+ return ret;
28
+ }, []);
29
+ }
30
+ async readFile(filePath) {
31
+ if (!this.#context.fs.isFileSync(filePath)) return "";
32
+ return await this.#context.fs.read(filePath);
33
+ }
34
+ readFileSync(filePath) {
35
+ if (!this.#context.fs.isFileSync(filePath)) return "";
36
+ return this.#context.fs.readSync(filePath);
37
+ }
38
+ async writeFile(filePath, fileText) {
39
+ return this.#context.fs.write(filePath, fileText);
40
+ }
41
+ writeFileSync(filePath, fileText) {
42
+ this.#context.fs.writeSync(filePath, fileText);
43
+ }
44
+ async mkdir(dirPath) {
45
+ await this.#context.fs.mkdir(dirPath);
46
+ }
47
+ mkdirSync(dirPath) {
48
+ this.#context.fs.mkdirSync(dirPath);
49
+ }
50
+ async move(srcPath, destPath) {
51
+ await this.#context.fs.move(srcPath, destPath);
52
+ }
53
+ moveSync(srcPath, destPath) {
54
+ this.#context.fs.moveSync(srcPath, destPath);
55
+ }
56
+ async copy(srcPath, destPath) {
57
+ await this.#context.fs.copy(srcPath, destPath);
58
+ }
59
+ copySync(srcPath, destPath) {
60
+ this.#context.fs.copySync(srcPath, destPath);
61
+ }
62
+ async fileExists(filePath) {
63
+ return this.#context.fs.isFile(filePath);
64
+ }
65
+ fileExistsSync(filePath) {
66
+ return this.#context.fs.isFileSync(filePath);
67
+ }
68
+ async directoryExists(dirPath) {
69
+ return this.#context.fs.isDirectory(dirPath);
70
+ }
71
+ directoryExistsSync(dirPath) {
72
+ return this.#context.fs.isDirectorySync(dirPath);
73
+ }
74
+ realpathSync(path) {
75
+ return this.#context.fs.resolveSync(path) || path;
76
+ }
77
+ getCurrentDirectory() {
78
+ return this.#context.workspaceConfig.workspaceRoot;
79
+ }
80
+ async glob(patterns) {
81
+ return this.#context.fs.glob(patterns);
82
+ }
83
+ globSync(patterns) {
84
+ return this.#context.fs.globSync(patterns);
85
+ }
86
+ };
87
+ /**
88
+ * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
89
+ *
90
+ * @param context - The Powerlines context
91
+ * @returns A ts-morph {@link Project} instance
92
+ */
93
+ function createProgram(context, override) {
94
+ context.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
95
+ return new ts_morph.Project((0, defu.default)(override ?? {}, {
96
+ skipAddingFilesFromTsConfig: false,
97
+ tsConfigFilePath: context.tsconfig.tsconfigFilePath,
98
+ fileSystem: new VirtualFileSystemHost(context),
99
+ compilerOptions: (0, defu.default)(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
100
+ }));
101
+ }
102
+
103
+ //#endregion
104
+ exports.createProgram = createProgram;
@@ -0,0 +1,102 @@
1
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
2
+ import defu$1 from "defu";
3
+ import { InMemoryFileSystemHost, Project } from "ts-morph";
4
+
5
+ //#region ../powerlines/src/lib/typescript/ts-morph.ts
6
+ var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
7
+ #context;
8
+ constructor(context) {
9
+ super();
10
+ this.#context = context;
11
+ }
12
+ deleteSync(path) {
13
+ this.#context.fs.removeSync(path);
14
+ }
15
+ readDirSync(dirPath) {
16
+ if (!this.#context.fs.isDirectorySync(dirPath)) return [];
17
+ return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
18
+ const fullPath = this.#context.fs.resolveSync(entry);
19
+ if (fullPath) ret.push({
20
+ name: entry,
21
+ isDirectory: this.#context.fs.isDirectorySync(fullPath),
22
+ isFile: this.#context.fs.isFileSync(fullPath),
23
+ isSymlink: false
24
+ });
25
+ return ret;
26
+ }, []);
27
+ }
28
+ async readFile(filePath) {
29
+ if (!this.#context.fs.isFileSync(filePath)) return "";
30
+ return await this.#context.fs.read(filePath);
31
+ }
32
+ readFileSync(filePath) {
33
+ if (!this.#context.fs.isFileSync(filePath)) return "";
34
+ return this.#context.fs.readSync(filePath);
35
+ }
36
+ async writeFile(filePath, fileText) {
37
+ return this.#context.fs.write(filePath, fileText);
38
+ }
39
+ writeFileSync(filePath, fileText) {
40
+ this.#context.fs.writeSync(filePath, fileText);
41
+ }
42
+ async mkdir(dirPath) {
43
+ await this.#context.fs.mkdir(dirPath);
44
+ }
45
+ mkdirSync(dirPath) {
46
+ this.#context.fs.mkdirSync(dirPath);
47
+ }
48
+ async move(srcPath, destPath) {
49
+ await this.#context.fs.move(srcPath, destPath);
50
+ }
51
+ moveSync(srcPath, destPath) {
52
+ this.#context.fs.moveSync(srcPath, destPath);
53
+ }
54
+ async copy(srcPath, destPath) {
55
+ await this.#context.fs.copy(srcPath, destPath);
56
+ }
57
+ copySync(srcPath, destPath) {
58
+ this.#context.fs.copySync(srcPath, destPath);
59
+ }
60
+ async fileExists(filePath) {
61
+ return this.#context.fs.isFile(filePath);
62
+ }
63
+ fileExistsSync(filePath) {
64
+ return this.#context.fs.isFileSync(filePath);
65
+ }
66
+ async directoryExists(dirPath) {
67
+ return this.#context.fs.isDirectory(dirPath);
68
+ }
69
+ directoryExistsSync(dirPath) {
70
+ return this.#context.fs.isDirectorySync(dirPath);
71
+ }
72
+ realpathSync(path) {
73
+ return this.#context.fs.resolveSync(path) || path;
74
+ }
75
+ getCurrentDirectory() {
76
+ return this.#context.workspaceConfig.workspaceRoot;
77
+ }
78
+ async glob(patterns) {
79
+ return this.#context.fs.glob(patterns);
80
+ }
81
+ globSync(patterns) {
82
+ return this.#context.fs.globSync(patterns);
83
+ }
84
+ };
85
+ /**
86
+ * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing
87
+ *
88
+ * @param context - The Powerlines context
89
+ * @returns A ts-morph {@link Project} instance
90
+ */
91
+ function createProgram(context, override) {
92
+ context.log(LogLevelLabel.TRACE, `Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
93
+ return new Project(defu$1(override ?? {}, {
94
+ skipAddingFilesFromTsConfig: false,
95
+ tsConfigFilePath: context.tsconfig.tsconfigFilePath,
96
+ fileSystem: new VirtualFileSystemHost(context),
97
+ compilerOptions: defu$1(context.tsconfig.options ?? {}, { lib: ["lib.esnext.full.d.ts"] })
98
+ }));
99
+ }
100
+
101
+ //#endregion
102
+ export { createProgram };
@@ -0,0 +1,149 @@
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 __stryke_path_append = require("@stryke/path/append");
6
+ let typescript = require("typescript");
7
+ typescript = require_rolldown_runtime.__toESM(typescript);
8
+ let __stryke_fs_json = require("@stryke/fs/json");
9
+ let __stryke_fs_exists = require("@stryke/fs/exists");
10
+
11
+ //#region ../powerlines/src/lib/typescript/tsconfig.ts
12
+ /**
13
+ * Get the path to the tsconfig.json file.
14
+ *
15
+ * @param workspaceRoot - The root directory of the workspace.
16
+ * @param projectRoot - The root directory of the project.
17
+ * @param tsconfig - The path to the tsconfig.json file.
18
+ * @returns The absolute path to the tsconfig.json file.
19
+ * @throws If the tsconfig.json file does not exist.
20
+ */
21
+ function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
22
+ let tsconfigFilePath;
23
+ if (tsconfig) tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
24
+ else {
25
+ tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.app.json");
26
+ if (!tsconfigFilePath) {
27
+ tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.lib.json");
28
+ if (!tsconfigFilePath) tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.json");
29
+ }
30
+ }
31
+ if (!tsconfigFilePath) throw new Error(`Cannot find the \`tsconfig.json\` configuration file for the project at ${projectRoot}.`);
32
+ return tsconfigFilePath;
33
+ }
34
+ /**
35
+ * Get the path to the tsconfig.json file.
36
+ *
37
+ * @param workspaceRoot - The root directory of the workspace.
38
+ * @param projectRoot - The root directory of the project.
39
+ * @param tsconfig - The path to the tsconfig.json file.
40
+ * @returns The absolute path to the tsconfig.json file.
41
+ * @throws If the tsconfig.json file does not exist.
42
+ */
43
+ function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
44
+ let tsconfigFilePath = tsconfig;
45
+ if (!(0, __stryke_fs_exists.existsSync)(tsconfigFilePath)) {
46
+ tsconfigFilePath = (0, __stryke_path_append.appendPath)(tsconfig, projectRoot);
47
+ if (!(0, __stryke_fs_exists.existsSync)(tsconfigFilePath)) {
48
+ tsconfigFilePath = (0, __stryke_path_append.appendPath)(tsconfig, (0, __stryke_path_append.appendPath)(projectRoot, workspaceRoot));
49
+ if (!(0, __stryke_fs_exists.existsSync)(tsconfigFilePath)) return;
50
+ }
51
+ }
52
+ return tsconfigFilePath;
53
+ }
54
+ /**
55
+ * Check if the TypeScript configuration type matches any of the provided types.
56
+ *
57
+ * @param tsconfigType - The type from the TypeScript configuration.
58
+ * @param types - An array of type names to check against.
59
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
60
+ */
61
+ function findMatch(tsconfigType, types, extensions = [
62
+ ".ts",
63
+ ".tsx",
64
+ ".d.ts"
65
+ ]) {
66
+ return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
67
+ }
68
+ /**
69
+ * Check if the TypeScript configuration type matches any of the provided types.
70
+ *
71
+ * @param tsconfigType - The type from the TypeScript configuration.
72
+ * @param types - An array of type names to check against.
73
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
74
+ */
75
+ function findIncludeMatch(tsconfigType, types) {
76
+ return findMatch(tsconfigType, types, [
77
+ ".ts",
78
+ ".tsx",
79
+ ".d.ts",
80
+ ".js",
81
+ ".jsx",
82
+ ".mjs",
83
+ ".cjs",
84
+ ".mts",
85
+ ".cts",
86
+ "/*.ts",
87
+ "/*.tsx",
88
+ "/*.d.ts",
89
+ "/*.js",
90
+ "/*.jsx",
91
+ "/*.mjs",
92
+ "/*.cjs",
93
+ "/*.mts",
94
+ "/*.cts",
95
+ "/**/*.ts",
96
+ "/**/*.tsx",
97
+ "/**/*.d.ts",
98
+ "/**/*.js",
99
+ "/**/*.jsx",
100
+ "/**/*.mjs",
101
+ "/**/*.cjs",
102
+ "/**/*.mts",
103
+ "/**/*.cts"
104
+ ]);
105
+ }
106
+ /**
107
+ * Check if the TypeScript configuration type matches any of the provided types.
108
+ *
109
+ * @param tsconfigType - The type from the TypeScript configuration.
110
+ * @param types - An array of type names to check against.
111
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
112
+ */
113
+ function isIncludeMatchFound(tsconfigType, types) {
114
+ return findIncludeMatch(tsconfigType, types) !== void 0;
115
+ }
116
+ /**
117
+ * Get the parsed TypeScript configuration.
118
+ *
119
+ * @param workspaceRoot - The root directory of the workspace.
120
+ * @param projectRoot - The root directory of the project.
121
+ * @param tsconfig - The path to the tsconfig.json file.
122
+ * @param tsconfigRaw - The raw tsconfig.json content.
123
+ * @param originalTsconfigJson - The original tsconfig.json content.
124
+ * @param host - The TypeScript parse config host.
125
+ * @returns The resolved TypeScript configuration.
126
+ */
127
+ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = typescript.default.sys) {
128
+ const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
129
+ const tsconfigJson = (0, __stryke_fs_json.readJsonFileSync)(tsconfigFilePath);
130
+ if (!tsconfigJson) throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${(0, __stryke_path_join_paths.joinPaths)(projectRoot, tsconfig ?? "tsconfig.json")}`);
131
+ const parsedCommandLine = typescript.default.parseJsonConfigFileContent((0, defu.default)(tsconfigRaw ?? {}, tsconfigJson), host, (0, __stryke_path_append.appendPath)(projectRoot, workspaceRoot));
132
+ if (parsedCommandLine.errors.length > 0) {
133
+ const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
134
+ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
135
+ `;
136
+ throw new Error(errorMessage);
137
+ }
138
+ return {
139
+ ...parsedCommandLine,
140
+ originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
141
+ tsconfigJson,
142
+ tsconfigFilePath
143
+ };
144
+ }
145
+
146
+ //#endregion
147
+ exports.getParsedTypeScriptConfig = getParsedTypeScriptConfig;
148
+ exports.getTsconfigFilePath = getTsconfigFilePath;
149
+ exports.isIncludeMatchFound = isIncludeMatchFound;
@@ -0,0 +1,144 @@
1
+ import defu$1 from "defu";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { appendPath } from "@stryke/path/append";
4
+ import ts from "typescript";
5
+ import { readJsonFileSync } from "@stryke/fs/json";
6
+ import { existsSync } from "@stryke/fs/exists";
7
+
8
+ //#region ../powerlines/src/lib/typescript/tsconfig.ts
9
+ /**
10
+ * Get the path to the tsconfig.json file.
11
+ *
12
+ * @param workspaceRoot - The root directory of the workspace.
13
+ * @param projectRoot - The root directory of the project.
14
+ * @param tsconfig - The path to the tsconfig.json file.
15
+ * @returns The absolute path to the tsconfig.json file.
16
+ * @throws If the tsconfig.json file does not exist.
17
+ */
18
+ function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
19
+ let tsconfigFilePath;
20
+ if (tsconfig) tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
21
+ else {
22
+ tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.app.json");
23
+ if (!tsconfigFilePath) {
24
+ tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.lib.json");
25
+ if (!tsconfigFilePath) tsconfigFilePath = tryTsconfigFilePath(workspaceRoot, projectRoot, "tsconfig.json");
26
+ }
27
+ }
28
+ if (!tsconfigFilePath) throw new Error(`Cannot find the \`tsconfig.json\` configuration file for the project at ${projectRoot}.`);
29
+ return tsconfigFilePath;
30
+ }
31
+ /**
32
+ * Get the path to the tsconfig.json file.
33
+ *
34
+ * @param workspaceRoot - The root directory of the workspace.
35
+ * @param projectRoot - The root directory of the project.
36
+ * @param tsconfig - The path to the tsconfig.json file.
37
+ * @returns The absolute path to the tsconfig.json file.
38
+ * @throws If the tsconfig.json file does not exist.
39
+ */
40
+ function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
41
+ let tsconfigFilePath = tsconfig;
42
+ if (!existsSync(tsconfigFilePath)) {
43
+ tsconfigFilePath = appendPath(tsconfig, projectRoot);
44
+ if (!existsSync(tsconfigFilePath)) {
45
+ tsconfigFilePath = appendPath(tsconfig, appendPath(projectRoot, workspaceRoot));
46
+ if (!existsSync(tsconfigFilePath)) return;
47
+ }
48
+ }
49
+ return tsconfigFilePath;
50
+ }
51
+ /**
52
+ * Check if the TypeScript configuration type matches any of the provided types.
53
+ *
54
+ * @param tsconfigType - The type from the TypeScript configuration.
55
+ * @param types - An array of type names to check against.
56
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
57
+ */
58
+ function findMatch(tsconfigType, types, extensions = [
59
+ ".ts",
60
+ ".tsx",
61
+ ".d.ts"
62
+ ]) {
63
+ return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
64
+ }
65
+ /**
66
+ * Check if the TypeScript configuration type matches any of the provided types.
67
+ *
68
+ * @param tsconfigType - The type from the TypeScript configuration.
69
+ * @param types - An array of type names to check against.
70
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
71
+ */
72
+ function findIncludeMatch(tsconfigType, types) {
73
+ return findMatch(tsconfigType, types, [
74
+ ".ts",
75
+ ".tsx",
76
+ ".d.ts",
77
+ ".js",
78
+ ".jsx",
79
+ ".mjs",
80
+ ".cjs",
81
+ ".mts",
82
+ ".cts",
83
+ "/*.ts",
84
+ "/*.tsx",
85
+ "/*.d.ts",
86
+ "/*.js",
87
+ "/*.jsx",
88
+ "/*.mjs",
89
+ "/*.cjs",
90
+ "/*.mts",
91
+ "/*.cts",
92
+ "/**/*.ts",
93
+ "/**/*.tsx",
94
+ "/**/*.d.ts",
95
+ "/**/*.js",
96
+ "/**/*.jsx",
97
+ "/**/*.mjs",
98
+ "/**/*.cjs",
99
+ "/**/*.mts",
100
+ "/**/*.cts"
101
+ ]);
102
+ }
103
+ /**
104
+ * Check if the TypeScript configuration type matches any of the provided types.
105
+ *
106
+ * @param tsconfigType - The type from the TypeScript configuration.
107
+ * @param types - An array of type names to check against.
108
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
109
+ */
110
+ function isIncludeMatchFound(tsconfigType, types) {
111
+ return findIncludeMatch(tsconfigType, types) !== void 0;
112
+ }
113
+ /**
114
+ * Get the parsed TypeScript configuration.
115
+ *
116
+ * @param workspaceRoot - The root directory of the workspace.
117
+ * @param projectRoot - The root directory of the project.
118
+ * @param tsconfig - The path to the tsconfig.json file.
119
+ * @param tsconfigRaw - The raw tsconfig.json content.
120
+ * @param originalTsconfigJson - The original tsconfig.json content.
121
+ * @param host - The TypeScript parse config host.
122
+ * @returns The resolved TypeScript configuration.
123
+ */
124
+ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts.sys) {
125
+ const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
126
+ const tsconfigJson = readJsonFileSync(tsconfigFilePath);
127
+ if (!tsconfigJson) throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
128
+ const parsedCommandLine = ts.parseJsonConfigFileContent(defu$1(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
129
+ if (parsedCommandLine.errors.length > 0) {
130
+ const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
131
+ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
132
+ `;
133
+ throw new Error(errorMessage);
134
+ }
135
+ return {
136
+ ...parsedCommandLine,
137
+ originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
138
+ tsconfigJson,
139
+ tsconfigFilePath
140
+ };
141
+ }
142
+
143
+ //#endregion
144
+ export { getParsedTypeScriptConfig, getTsconfigFilePath, isIncludeMatchFound };
@@ -0,0 +1,6 @@
1
+ require('../logger.cjs');
2
+ require('../../api.cjs');
3
+ require('../utilities/source-file.cjs');
4
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
5
+ let __stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
6
+ let unplugin = require("unplugin");
@@ -0,0 +1,8 @@
1
+ import "../logger.mjs";
2
+ import "../../api.mjs";
3
+ import "../utilities/source-file.mjs";
4
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
5
+ import "@stryke/fs/get-workspace-root";
6
+ import { setParseImpl } from "unplugin";
7
+
8
+ export { };
@@ -0,0 +1,17 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let defu = require("defu");
3
+
4
+ //#region ../powerlines/src/lib/unplugin/helpers.ts
5
+ /**
6
+ * Merges a base plugin context with an unplugin context, combining their properties.
7
+ *
8
+ * @param context - The base plugin context to merge into.
9
+ * @param unplugin - The unplugin context to merge from.
10
+ * @returns The merged context.
11
+ */
12
+ function combineContexts(context, unplugin) {
13
+ return (0, defu.defu)(context, unplugin);
14
+ }
15
+
16
+ //#endregion
17
+ exports.combineContexts = combineContexts;
@@ -0,0 +1,16 @@
1
+ import { defu } from "defu";
2
+
3
+ //#region ../powerlines/src/lib/unplugin/helpers.ts
4
+ /**
5
+ * Merges a base plugin context with an unplugin context, combining their properties.
6
+ *
7
+ * @param context - The base plugin context to merge into.
8
+ * @param unplugin - The unplugin context to merge from.
9
+ * @returns The merged context.
10
+ */
11
+ function combineContexts(context, unplugin) {
12
+ return defu(context, unplugin);
13
+ }
14
+
15
+ //#endregion
16
+ export { combineContexts };
@@ -0,0 +1,3 @@
1
+ require('./factory.cjs');
2
+ const require_helpers = require('./helpers.cjs');
3
+ const require_plugin = require('./plugin.cjs');
@@ -0,0 +1,5 @@
1
+ import "./factory.mjs";
2
+ import { combineContexts } from "./helpers.mjs";
3
+ import { createUnplugin } from "./plugin.mjs";
4
+
5
+ export { };