@powerlines/plugin-tsdown 0.1.247 → 0.1.249

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 (58) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/core/src/lib/logger.cjs +41 -0
  3. package/dist/core/src/lib/unplugin/helpers.cjs +19 -0
  4. package/dist/core/src/lib/unplugin/index.cjs +3 -0
  5. package/dist/core/src/lib/unplugin/module-resolution.cjs +66 -0
  6. package/dist/core/src/lib/unplugin/plugin.cjs +71 -0
  7. package/dist/core/src/lib/utilities/format.cjs +29 -0
  8. package/dist/core/src/lib/utilities/source-file.cjs +22 -0
  9. package/dist/core/src/plugin-utils/build-helpers.cjs +35 -0
  10. package/dist/core/src/plugin-utils/context-helpers.cjs +2 -0
  11. package/dist/core/src/plugin-utils/extend.cjs +3 -0
  12. package/dist/core/src/plugin-utils/format-package-json.cjs +19 -0
  13. package/dist/core/src/plugin-utils/get-config-path.cjs +1 -0
  14. package/dist/core/src/plugin-utils/helpers.cjs +51 -0
  15. package/dist/core/src/plugin-utils/index.cjs +8 -0
  16. package/dist/core/src/plugin-utils/merge.cjs +47 -0
  17. package/dist/core/src/plugin-utils/paths.cjs +2 -0
  18. package/dist/core/src/types/api.d.cts +103 -0
  19. package/dist/core/src/types/api.d.cts.map +1 -0
  20. package/dist/core/src/types/commands.cjs +16 -0
  21. package/dist/core/src/types/commands.d.cts +9 -0
  22. package/dist/core/src/types/commands.d.cts.map +1 -0
  23. package/dist/core/src/types/config.d.cts +551 -0
  24. package/dist/core/src/types/config.d.cts.map +1 -0
  25. package/dist/core/src/types/context.d.cts +511 -0
  26. package/dist/core/src/types/context.d.cts.map +1 -0
  27. package/dist/core/src/types/fs.d.cts +487 -0
  28. package/dist/core/src/types/fs.d.cts.map +1 -0
  29. package/dist/core/src/types/hooks.d.cts +99 -0
  30. package/dist/core/src/types/hooks.d.cts.map +1 -0
  31. package/dist/core/src/types/plugin.cjs +31 -0
  32. package/dist/core/src/types/plugin.d.cts +204 -0
  33. package/dist/core/src/types/plugin.d.cts.map +1 -0
  34. package/dist/core/src/types/tsconfig.d.cts +70 -0
  35. package/dist/core/src/types/tsconfig.d.cts.map +1 -0
  36. package/dist/core/src/types/unplugin.cjs +22 -0
  37. package/dist/core/src/types/unplugin.d.cts +24 -0
  38. package/dist/core/src/types/unplugin.d.cts.map +1 -0
  39. package/dist/helpers/index.cjs +8 -0
  40. package/dist/helpers/index.d.cts +3 -0
  41. package/dist/helpers/resolve-options.cjs +128 -0
  42. package/dist/helpers/resolve-options.d.cts +30 -0
  43. package/dist/helpers/resolve-options.d.cts.map +1 -0
  44. package/dist/helpers/unplugin.cjs +12 -0
  45. package/dist/helpers/unplugin.d.cts +8 -0
  46. package/dist/helpers/unplugin.d.cts.map +1 -0
  47. package/dist/index.cjs +44 -0
  48. package/dist/index.d.cts +14 -0
  49. package/dist/index.d.cts.map +1 -0
  50. package/dist/types/build.cjs +0 -0
  51. package/dist/types/build.d.cts +8 -0
  52. package/dist/types/build.d.cts.map +1 -0
  53. package/dist/types/index.cjs +0 -0
  54. package/dist/types/index.d.cts +3 -0
  55. package/dist/types/plugin.cjs +0 -0
  56. package/dist/types/plugin.d.cts +20 -0
  57. package/dist/types/plugin.d.cts.map +1 -0
  58. package/package.json +30 -12
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,41 @@
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 __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
4
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
5
+ require("@storm-software/config-tools/logger");
6
+ require("@storm-software/config-tools/utilities/colors");
7
+ require("@stryke/helpers/noop");
8
+ let chalk = require("chalk");
9
+ chalk = require_rolldown_runtime.__toESM(chalk);
10
+
11
+ //#region ../core/src/lib/logger.ts
12
+ const BADGE_COLORS = [
13
+ "#00A0DD",
14
+ "#6FCE4E",
15
+ "#FBBF24",
16
+ "#F43F5E",
17
+ "#3B82F6",
18
+ "#A855F7",
19
+ "#469592",
20
+ "#288EDF",
21
+ "#D8B4FE",
22
+ "#10B981",
23
+ "#EF4444",
24
+ "#F0EC56",
25
+ "#F472B6",
26
+ "#22D3EE",
27
+ "#EAB308",
28
+ "#84CC16",
29
+ "#F87171",
30
+ "#0EA5E9",
31
+ "#D946EF",
32
+ "#FACC15",
33
+ "#34D399",
34
+ "#8B5CF6"
35
+ ];
36
+ const extendLog = (logFn, name) => {
37
+ 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(" ")} `);
38
+ };
39
+
40
+ //#endregion
41
+ exports.extendLog = extendLog;
@@ -0,0 +1,19 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ require('../../types/unplugin.cjs');
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+ let defu = require("defu");
5
+
6
+ //#region ../core/src/lib/unplugin/helpers.ts
7
+ /**
8
+ * Merges a base plugin context with an unplugin context, combining their properties.
9
+ *
10
+ * @param contextA - The base plugin context to merge into.
11
+ * @param contextB - The unplugin context to merge from.
12
+ * @returns The merged context.
13
+ */
14
+ function combineContexts(contextA, contextB) {
15
+ return (0, defu.defu)(contextA, contextB);
16
+ }
17
+
18
+ //#endregion
19
+ exports.combineContexts = combineContexts;
@@ -0,0 +1,3 @@
1
+ const require_helpers = require('./helpers.cjs');
2
+ const require_module_resolution = require('./module-resolution.cjs');
3
+ const require_plugin = require('./plugin.cjs');
@@ -0,0 +1,66 @@
1
+
2
+ //#region ../core/src/lib/unplugin/module-resolution.ts
3
+ /**
4
+ * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
5
+ *
6
+ * @remarks
7
+ * This includes the `resolveId` and `load` hooks.
8
+ *
9
+ * @see https://rollupjs.org/plugin-development/#resolveid
10
+ * @see https://rollupjs.org/plugin-development/#load
11
+ *
12
+ * @param context - The plugin context.
13
+ * @returns The module resolution hooks (`resolveId` and `load`).
14
+ */
15
+ function createUnpluginModuleResolutionFunctions(context) {
16
+ const ctx = context;
17
+ async function resolveId(id, importer, opts = { isEntry: false }) {
18
+ let result = await ctx.$$internal.callHook("resolveId", {
19
+ sequential: true,
20
+ result: "first",
21
+ order: "pre"
22
+ }, id, importer, opts);
23
+ if (result) return result;
24
+ result = await ctx.$$internal.callHook("resolveId", {
25
+ sequential: true,
26
+ result: "first",
27
+ order: "normal"
28
+ }, id, importer, opts);
29
+ if (result) return result;
30
+ result = await ctx.resolve(id, importer, opts);
31
+ if (result) return result;
32
+ return ctx.$$internal.callHook("resolveId", {
33
+ sequential: true,
34
+ result: "first",
35
+ order: "post"
36
+ }, id, importer, opts);
37
+ }
38
+ async function load(id) {
39
+ let result = await ctx.$$internal.callHook("load", {
40
+ sequential: true,
41
+ result: "first",
42
+ order: "pre"
43
+ }, id);
44
+ if (result) return result;
45
+ result = await ctx.$$internal.callHook("load", {
46
+ sequential: true,
47
+ result: "first",
48
+ order: "normal"
49
+ }, id);
50
+ if (result) return result;
51
+ result = await ctx.load(id);
52
+ if (result) return result;
53
+ return ctx.$$internal.callHook("load", {
54
+ sequential: true,
55
+ result: "first",
56
+ order: "post"
57
+ }, id);
58
+ }
59
+ return {
60
+ resolveId,
61
+ load
62
+ };
63
+ }
64
+
65
+ //#endregion
66
+ exports.createUnpluginModuleResolutionFunctions = createUnpluginModuleResolutionFunctions;
@@ -0,0 +1,71 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_helpers = require('./helpers.cjs');
3
+ const require_module_resolution = require('./module-resolution.cjs');
4
+ const require_logger = require('../logger.cjs');
5
+ const require_source_file = require('../utilities/source-file.cjs');
6
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
7
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
8
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
9
+ let unplugin = require("unplugin");
10
+
11
+ //#region ../core/src/lib/unplugin/plugin.ts
12
+ /**
13
+ * Creates a Powerlines unplugin instance.
14
+ *
15
+ * @param context - The plugin context.
16
+ * @returns The unplugin instance.
17
+ */
18
+ function createUnplugin(context, name = "unplugin") {
19
+ const ctx = context;
20
+ (0, unplugin.setParseImpl)(ctx.parse);
21
+ return () => {
22
+ const log = require_logger.extendLog(ctx.log, name);
23
+ log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
24
+ try {
25
+ const { resolveId, load } = require_module_resolution.createUnpluginModuleResolutionFunctions(context);
26
+ async function buildStart() {
27
+ log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
28
+ await ctx.$$internal.callHook("buildStart", { sequential: true });
29
+ }
30
+ async function transform(code, id) {
31
+ let transformed = code;
32
+ for (const hook of ctx.$$internal.environment.selectHooks("transform")) {
33
+ const result = await hook.handler.apply(require_helpers.combineContexts(ctx, this), [require_source_file.getString(transformed), id]);
34
+ if (result) transformed = result;
35
+ }
36
+ return transformed;
37
+ }
38
+ async function buildEnd() {
39
+ log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin finishing...");
40
+ return ctx.$$internal.callHook("buildEnd", { sequential: true });
41
+ }
42
+ async function writeBundle() {
43
+ log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
44
+ return ctx.$$internal.callHook("writeBundle", { sequential: true });
45
+ }
46
+ return {
47
+ name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
48
+ api: ctx.$$internal.api,
49
+ resolveId: {
50
+ filter: { id: { include: [/.*/] } },
51
+ handler: resolveId
52
+ },
53
+ load: {
54
+ filter: { id: { include: [/.*/] } },
55
+ handler: load
56
+ },
57
+ transform,
58
+ buildStart,
59
+ buildEnd,
60
+ writeBundle,
61
+ vite: { sharedDuringBuild: true }
62
+ };
63
+ } catch (error) {
64
+ log(__storm_software_config_tools_types.LogLevelLabel.FATAL, error?.message);
65
+ throw error;
66
+ }
67
+ };
68
+ }
69
+
70
+ //#endregion
71
+ exports.createUnplugin = createUnplugin;
@@ -0,0 +1,29 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ require("@stryke/fs/list-files");
3
+ let __stryke_path_append = require("@stryke/path/append");
4
+ let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
5
+ let prettier = require("prettier");
6
+
7
+ //#region ../core/src/lib/utilities/format.ts
8
+ /**
9
+ * Formats code using Prettier based on the file path.
10
+ *
11
+ * @param context - The Powerlines context.
12
+ * @param path - The file path to use for resolving Prettier configuration.
13
+ * @param data - The code string to format.
14
+ * @param force - Whether to force formatting even for output/build paths.
15
+ * @returns A promise that resolves to the formatted code string.
16
+ */
17
+ async function format(context, path, data, force = false) {
18
+ if (!force && ((0, __stryke_path_is_parent_path.isParentPath)(path, (0, __stryke_path_append.appendPath)(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) || (0, __stryke_path_is_parent_path.isParentPath)(path, (0, __stryke_path_append.appendPath)(context.config.output.buildPath, context.workspaceConfig.workspaceRoot)))) return data;
19
+ let code = data;
20
+ const resolvedConfig = await (0, prettier.resolveConfig)(path);
21
+ if (resolvedConfig) code = await (0, prettier.format)(data, {
22
+ absolutePath: path,
23
+ ...resolvedConfig
24
+ });
25
+ return code;
26
+ }
27
+
28
+ //#endregion
29
+ exports.format = format;
@@ -0,0 +1,22 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
3
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
4
+ require("@stryke/fs/read-file");
5
+ require("magic-string");
6
+
7
+ //#region ../core/src/lib/utilities/source-file.ts
8
+ /**
9
+ * Get the string from the source.
10
+ *
11
+ * @param code - The source string or magic string.
12
+ * @returns The source string.
13
+ */
14
+ function getString(code) {
15
+ if (!code) return "";
16
+ if ((0, __stryke_type_checks_is_string.isString)(code)) return code;
17
+ if ((0, __stryke_type_checks_is_set_object.isSetObject)(code) && "code" in code) return code.code;
18
+ return code.toString();
19
+ }
20
+
21
+ //#endregion
22
+ exports.getString = getString;
@@ -0,0 +1,35 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
3
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
4
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
5
+ let __stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
6
+
7
+ //#region ../core/src/plugin-utils/build-helpers.ts
8
+ /**
9
+ * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
10
+ *
11
+ * @param context - The build context.
12
+ * @returns The dependency configuration.
13
+ */
14
+ function getDependencyConfig(context) {
15
+ const noExternal = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.noExternal).concat(context.builtins));
16
+ const external = (0, __stryke_helpers_get_unique.getUnique)((0, __stryke_convert_to_array.toArray)(context.config.resolve.external).reduce((ret, ext) => {
17
+ if ((0, __stryke_type_checks_is_regexp.isRegExp)(ext)) {
18
+ if (noExternal.some((noExt) => (0, __stryke_type_checks_is_regexp.isRegExp)(noExt) && noExt.source === ext.source)) return ret;
19
+ const noExts = noExternal.filter((noExt) => (0, __stryke_type_checks_is_set_string.isSetString)(noExt) && ext.test(noExt));
20
+ if (noExts.length > 0) {
21
+ ret.push(new RegExp(noExts.reduce((regex, noExt) => `(?!${(0, __stryke_type_checks_is_regexp.isRegExp)(noExt) ? noExt.source : `^${noExt}$`})${regex}`, `${ext.source.replace(/^\^@\?/, "^@").replace(/^@\?/, "@").replace(/\$$/, "").replace(/\.\*$/, "")}.*$`)));
22
+ return ret;
23
+ }
24
+ }
25
+ ret.push(ext);
26
+ return ret;
27
+ }, []));
28
+ return {
29
+ external: external.length === 0 ? void 0 : external,
30
+ noExternal: noExternal.length === 0 ? void 0 : noExternal
31
+ };
32
+ }
33
+
34
+ //#endregion
35
+ exports.getDependencyConfig = getDependencyConfig;
@@ -0,0 +1,2 @@
1
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
2
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
@@ -0,0 +1,3 @@
1
+ require('./merge.cjs');
2
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
3
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
@@ -0,0 +1,19 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_format = require('../lib/utilities/format.cjs');
3
+ let __stryke_path_join = require("@stryke/path/join");
4
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
+
6
+ //#region ../core/src/plugin-utils/format-package-json.ts
7
+ /**
8
+ * Formats the `package.json` file in the project root.
9
+ *
10
+ * @param context - The powerlines context.
11
+ */
12
+ async function formatPackageJson(context) {
13
+ const packageJsonPath = (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "package.json");
14
+ const packageJsonFile = await context.fs.read(packageJsonPath);
15
+ if ((0, __stryke_type_checks_is_set_string.isSetString)(packageJsonFile)) await context.fs.write(packageJsonPath, await require_format.format(context, packageJsonPath, packageJsonFile));
16
+ }
17
+
18
+ //#endregion
19
+ exports.formatPackageJson = formatPackageJson;
@@ -0,0 +1 @@
1
+ let __stryke_path_join = require("@stryke/path/join");
@@ -0,0 +1,51 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ require('../types/unplugin.cjs');
3
+ require('../types/plugin.cjs');
4
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
7
+ require("@stryke/type-checks/is-undefined");
8
+
9
+ //#region ../core/src/plugin-utils/helpers.ts
10
+ /**
11
+ * Type guard to check if an value is a {@link PluginHook} function
12
+ *
13
+ * @param value - The value to check
14
+ * @returns True if the value is a {@link PluginHook} function, false otherwise
15
+ */
16
+ function isPluginHookObject(value) {
17
+ return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "handler" in value && (0, __stryke_type_checks_is_function.isFunction)(value.handler);
18
+ }
19
+ /**
20
+ * Type guard to check if an value is a {@link PluginHook} function
21
+ *
22
+ * @param value - The value to check
23
+ * @returns True if the value is a {@link PluginHook} function, false otherwise
24
+ */
25
+ function isPluginHookFunction(value) {
26
+ return (0, __stryke_type_checks_is_function.isFunction)(value) || isPluginHookObject(value);
27
+ }
28
+ /**
29
+ * Type guard to check if an object is a {@link PluginHook}
30
+ *
31
+ * @param value - The object to check
32
+ * @returns True if the object is a {@link PluginHook}, false otherwise
33
+ */
34
+ function isPluginHook(value) {
35
+ return isPluginHookFunction(value) || isPluginHookObject(value);
36
+ }
37
+ /**
38
+ * Extract the hook handler function from a plugin hook
39
+ *
40
+ * @param pluginHook - The plugin hook to extract the handler function from
41
+ * @returns The hook handler function
42
+ */
43
+ function getHookHandler(pluginHook) {
44
+ return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? pluginHook : pluginHook.handler;
45
+ }
46
+
47
+ //#endregion
48
+ exports.getHookHandler = getHookHandler;
49
+ exports.isPluginHook = isPluginHook;
50
+ exports.isPluginHookFunction = isPluginHookFunction;
51
+ exports.isPluginHookObject = isPluginHookObject;
@@ -0,0 +1,8 @@
1
+ const require_format_package_json = require('./format-package-json.cjs');
2
+ const require_build_helpers = require('./build-helpers.cjs');
3
+ require('./context-helpers.cjs');
4
+ const require_helpers = require('./helpers.cjs');
5
+ require('./merge.cjs');
6
+ require('./extend.cjs');
7
+ require('./get-config-path.cjs');
8
+ require('./paths.cjs');
@@ -0,0 +1,47 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_helpers = require('./helpers.cjs');
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+ let defu = require("defu");
5
+ defu = require_rolldown_runtime.__toESM(defu);
6
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
+
8
+ //#region ../core/src/plugin-utils/merge.ts
9
+ const mergePlugin = (0, defu.createDefu)((obj, key, value) => {
10
+ if (require_helpers.isPluginHook(obj[key]) && require_helpers.isPluginHook(value)) {
11
+ obj[key] = {
12
+ ...obj[key],
13
+ ...value,
14
+ handler: async (...params) => {
15
+ const [resultA, resultB] = await Promise.all([require_helpers.getHookHandler(obj[key])(...params), require_helpers.getHookHandler(value)(...params)]);
16
+ return resultB && resultA ? (0, defu.default)(resultA, resultB) : resultA || resultB;
17
+ }
18
+ };
19
+ return true;
20
+ }
21
+ return false;
22
+ });
23
+ /**
24
+ * Merges two configuration objects together, with special handling for string values.
25
+ * If the value from the second object is a non-empty string, it will overwrite the value from the first object.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const configA = { name: "Default", version: "1.0.0" };
30
+ * const configB = { name: "Custom", description: "A custom config" };
31
+ * const mergedConfig = mergeConfig(configA, configB);
32
+ * // Result: { name: "Custom", version: "1.0.0", description: "A custom config" }
33
+ * ```
34
+ *
35
+ * @param objA - The first configuration object.
36
+ * @param objB - The second configuration object.
37
+ * @returns The merged configuration object.
38
+ */
39
+ const mergeConfig = (0, defu.createDefu)((obj, key, value) => {
40
+ if ((0, __stryke_type_checks_is_string.isString)(obj[key]) && (0, __stryke_type_checks_is_string.isString)(value)) {
41
+ if ((0, __stryke_type_checks_is_set_string.isSetString)(value)) obj[key] = value;
42
+ return true;
43
+ }
44
+ return false;
45
+ });
46
+
47
+ //#endregion
@@ -0,0 +1,2 @@
1
+ let __stryke_path_join = require("@stryke/path/join");
2
+ let __stryke_path_replace = require("@stryke/path/replace");
@@ -0,0 +1,103 @@
1
+ import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
2
+ import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
3
+ import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig } from "./config.cjs";
4
+
5
+ //#region ../core/src/types/api.d.ts
6
+
7
+ /**
8
+ * Powerlines API Interface
9
+ */
10
+ interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
11
+ /**
12
+ * The Powerlines shared API context
13
+ */
14
+ context: APIContext<TResolvedConfig>;
15
+ /**
16
+ * Prepare the Powerlines API
17
+ *
18
+ * @remarks
19
+ * This method will prepare the Powerlines API for use, initializing any necessary resources.
20
+ *
21
+ * @param inlineConfig - The inline configuration for the prepare command
22
+ */
23
+ prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
24
+ /**
25
+ * Create a new Powerlines project
26
+ *
27
+ * @remarks
28
+ * This method will create a new Powerlines project in the current directory.
29
+ *
30
+ * @param inlineConfig - The inline configuration for the new command
31
+ * @returns A promise that resolves when the project has been created
32
+ */
33
+ new: (inlineConfig: NewInlineConfig) => Promise<void>;
34
+ /**
35
+ * Clean any previously prepared artifacts
36
+ *
37
+ * @remarks
38
+ * This method will remove the previous Powerlines artifacts from the project.
39
+ *
40
+ * @param inlineConfig - The inline configuration for the clean command
41
+ * @returns A promise that resolves when the clean command has completed
42
+ */
43
+ clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
44
+ /**
45
+ * Lint the project source code
46
+ *
47
+ * @param inlineConfig - The inline configuration for the lint command
48
+ * @returns A promise that resolves when the lint command has completed
49
+ */
50
+ lint: (inlineConfig: LintInlineConfig) => Promise<void>;
51
+ /**
52
+ * Build the project
53
+ *
54
+ * @remarks
55
+ * This method will build the Powerlines project, generating the necessary artifacts.
56
+ *
57
+ * @param inlineConfig - The inline configuration for the build command
58
+ * @returns A promise that resolves when the build command has completed
59
+ */
60
+ build: (inlineConfig: BuildInlineConfig) => Promise<void>;
61
+ /**
62
+ * Prepare the documentation for the project
63
+ *
64
+ * @param inlineConfig - The inline configuration for the docs command
65
+ * @returns A promise that resolves when the documentation generation has completed
66
+ */
67
+ docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
68
+ /**
69
+ * Deploy the project source code
70
+ *
71
+ * @remarks
72
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
73
+ *
74
+ * @param inlineConfig - The inline configuration for the deploy command
75
+ */
76
+ deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
77
+ /**
78
+ * Finalization process
79
+ *
80
+ * @remarks
81
+ * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
82
+ *
83
+ * @returns A promise that resolves when the finalization process has completed
84
+ */
85
+ finalize: () => Promise<void>;
86
+ /**
87
+ * Invokes the configured plugin hooks
88
+ *
89
+ * @remarks
90
+ * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
91
+ *
92
+ * @param hook - The hook to call
93
+ * @param options - The options to provide to the hook
94
+ * @param args - The arguments to pass to the hook
95
+ * @returns The result of the hook call
96
+ */
97
+ callHook: <TKey extends string>(hook: TKey, options: CallHookOptions & {
98
+ environment?: string | EnvironmentContext<TResolvedConfig>;
99
+ }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
100
+ }
101
+ //#endregion
102
+ export { API };
103
+ //# sourceMappingURL=api.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.cts","names":[],"sources":["../../../../../core/src/types/api.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAsCA;AAA6C,UAA5B,GAA4B,CAAA,wBAAA,cAAA,GAAiB,cAAjB,CAAA,CAAA;EAAiB;;;EAgBtD,OAAA,EAZG,UAYH,CAZc,eAYd,CAAA;EACA;;;;;;;;EAiBkC,OAAA,EAAA,CAAA,YAAA,EAlBlC,mBAkBkC,GAjBlC,eAiBkC,GAhBlC,iBAgBkC,GAflC,iBAekC,GAdlC,gBAckC,GAblC,gBAakC,GAZlC,kBAYkC,EAAA,GAXnC,OAWmC,CAAA,IAAA,CAAA;EAYxB;;;;;;;;;EAsCO,GAAA,EAAA,CAAA,YAAA,EAlDH,eAkDG,EAAA,GAlDiB,OAkDjB,CAAA,IAAA,CAAA;EAAuB;;;;;;;;;EA4BnC,KAAA,EAAA,CAAA,YAAA,EAlEK,iBAkEL,GAlEyB,mBAkEzB,EAAA,GAjEN,OAiEM,CAAA,IAAA,CAAA;EAEyB;;;;;;uBA3Df,qBAAqB;;;;;;;;;;wBAWpB,sBAAsB;;;;;;;uBAQvB,qBAAqB;;;;;;;;;yBAUnB,uBAAuB;;;;;;;;;kBAU9B;;;;;;;;;;;;wCAcR,eACG;2BACgB,mBAAmB;cAEnC,oBAAoB,cAAc,kBAAkB,UAC1D,QACH,oBAAoB,cAAc,kBAAkB"}
@@ -0,0 +1,16 @@
1
+
2
+ //#region ../core/src/types/commands.ts
3
+ const SUPPORTED_COMMANDS = [
4
+ "new",
5
+ "clean",
6
+ "prepare",
7
+ "lint",
8
+ "test",
9
+ "build",
10
+ "docs",
11
+ "deploy",
12
+ "finalize"
13
+ ];
14
+
15
+ //#endregion
16
+ exports.SUPPORTED_COMMANDS = SUPPORTED_COMMANDS;
@@ -0,0 +1,9 @@
1
+ import { MaybePromise } from "@stryke/types/base";
2
+ import { ArrayValues } from "@stryke/types/array";
3
+
4
+ //#region ../core/src/types/commands.d.ts
5
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
6
+ type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
7
+ //#endregion
8
+ export { CommandType };
9
+ //# sourceMappingURL=commands.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.cts","names":[],"sources":["../../../../../core/src/types/commands.ts"],"sourcesContent":[],"mappings":";;;;cAsBa;AAAA,KAYD,WAAA,GAAc,WAFhB,CAAA,OAEmC,kBAFnC,CAAA"}