@powerlines/plugin-vite 0.14.122 → 0.14.124

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/helpers/index.cjs +3 -2
  2. package/dist/helpers/index.d.cts +3 -1
  3. package/dist/helpers/index.d.mts +3 -1
  4. package/dist/helpers/index.mjs +2 -1
  5. package/dist/helpers/unplugin.cjs +2 -11
  6. package/dist/helpers/unplugin.d.cts +2 -6
  7. package/dist/helpers/unplugin.d.mts +2 -6
  8. package/dist/helpers/unplugin.mjs +1 -9
  9. package/dist/helpers-CmEjzAn_.mjs +1 -0
  10. package/dist/helpers-LF26RHol.cjs +0 -0
  11. package/dist/index-BR1oNnaF.d.cts +1 -0
  12. package/dist/index-DEHBdV_z.d.mts +1 -0
  13. package/dist/index-_wQ5ClJU.d.cts +1 -0
  14. package/dist/index-vkGVyY9v.d.mts +1 -0
  15. package/dist/index.cjs +170 -9
  16. package/dist/index.d.cts +4 -3
  17. package/dist/index.d.mts +5 -5
  18. package/dist/index.mjs +165 -3
  19. package/dist/plugin-Dc12T6ZF.d.mts +1960 -0
  20. package/dist/plugin-jZ9N9Mz-.mjs +1 -0
  21. package/dist/plugin-pBKbb5K9.cjs +0 -0
  22. package/dist/plugin-vkCGh5de.d.cts +1957 -0
  23. package/dist/types/index.cjs +2 -0
  24. package/dist/types/index.d.cts +2 -1
  25. package/dist/types/index.d.mts +2 -1
  26. package/dist/types/index.mjs +3 -0
  27. package/dist/types/internal.d.cts +191 -3
  28. package/dist/types/internal.d.mts +191 -3
  29. package/dist/types/plugin.cjs +1 -0
  30. package/dist/types/plugin.d.cts +1 -12
  31. package/dist/types/plugin.d.mts +1 -12
  32. package/dist/types/plugin.mjs +2 -0
  33. package/dist/types-BtDR9wb1.mjs +1 -0
  34. package/dist/types-o3zWarRp.cjs +0 -0
  35. package/dist/unplugin-B3TcDD6I.mjs +4617 -0
  36. package/dist/unplugin-Bv2agFkI.cjs +4661 -0
  37. package/dist/unplugin-D_zrAqRh.d.mts +7 -0
  38. package/dist/unplugin-F1UAxbOS.d.cts +7 -0
  39. package/package.json +5 -5
  40. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  41. package/dist/powerlines/schemas/fs.cjs +0 -226
  42. package/dist/powerlines/schemas/fs.mjs +0 -224
  43. package/dist/powerlines/src/api.cjs +0 -580
  44. package/dist/powerlines/src/api.mjs +0 -578
  45. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
  46. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
  47. package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
  48. package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
  49. package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
  50. package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
  51. package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
  52. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -48
  53. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -50
  54. package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
  55. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
  56. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
  57. package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
  58. package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
  59. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
  60. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
  61. package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
  62. package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
  63. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  64. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  65. package/dist/powerlines/src/lib/build/vite.cjs +0 -74
  66. package/dist/powerlines/src/lib/build/vite.mjs +0 -71
  67. package/dist/powerlines/src/lib/config-file.cjs +0 -79
  68. package/dist/powerlines/src/lib/config-file.mjs +0 -76
  69. package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
  70. package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
  71. package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
  72. package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
  73. package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
  74. package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
  75. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
  76. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
  77. package/dist/powerlines/src/lib/entry.cjs +0 -69
  78. package/dist/powerlines/src/lib/entry.mjs +0 -67
  79. package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
  80. package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
  81. package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
  82. package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
  83. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
  84. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
  85. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
  86. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
  87. package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
  88. package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
  89. package/dist/powerlines/src/lib/logger.cjs +0 -58
  90. package/dist/powerlines/src/lib/logger.mjs +0 -55
  91. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
  92. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
  93. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
  94. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
  95. package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
  96. package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
  97. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
  98. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
  99. package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
  100. package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
  101. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
  102. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
  103. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  104. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  105. package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
  106. package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
  107. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
  108. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
  109. package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
  110. package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
  111. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
  112. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
  113. package/dist/powerlines/src/types/api.d.cts +0 -104
  114. package/dist/powerlines/src/types/api.d.mts +0 -104
  115. package/dist/powerlines/src/types/babel.d.mts +0 -4
  116. package/dist/powerlines/src/types/build.cjs +0 -15
  117. package/dist/powerlines/src/types/build.d.cts +0 -154
  118. package/dist/powerlines/src/types/build.d.mts +0 -154
  119. package/dist/powerlines/src/types/build.mjs +0 -14
  120. package/dist/powerlines/src/types/commands.cjs +0 -16
  121. package/dist/powerlines/src/types/commands.d.cts +0 -8
  122. package/dist/powerlines/src/types/commands.d.mts +0 -9
  123. package/dist/powerlines/src/types/commands.mjs +0 -15
  124. package/dist/powerlines/src/types/config.d.cts +0 -416
  125. package/dist/powerlines/src/types/config.d.mts +0 -418
  126. package/dist/powerlines/src/types/context.d.cts +0 -514
  127. package/dist/powerlines/src/types/context.d.mts +0 -514
  128. package/dist/powerlines/src/types/fs.d.cts +0 -486
  129. package/dist/powerlines/src/types/fs.d.mts +0 -486
  130. package/dist/powerlines/src/types/hooks.d.cts +0 -30
  131. package/dist/powerlines/src/types/hooks.d.mts +0 -30
  132. package/dist/powerlines/src/types/internal.d.cts +0 -58
  133. package/dist/powerlines/src/types/internal.d.mts +0 -58
  134. package/dist/powerlines/src/types/plugin.cjs +0 -32
  135. package/dist/powerlines/src/types/plugin.d.cts +0 -234
  136. package/dist/powerlines/src/types/plugin.d.mts +0 -234
  137. package/dist/powerlines/src/types/plugin.mjs +0 -31
  138. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  139. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  140. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  141. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,138 +0,0 @@
1
- import { UNPLUGIN_BUILD_VARIANTS } from "../types/build.mjs";
2
- import { KNOWN_HOOKS } from "../types/plugin.mjs";
3
- import { isSetString } from "@stryke/type-checks/is-set-string";
4
- import { isFunction } from "@stryke/type-checks/is-function";
5
- import { isSetObject } from "@stryke/type-checks/is-set-object";
6
- import { isUndefined } from "@stryke/type-checks/is-undefined";
7
-
8
- //#region ../powerlines/src/plugin-utils/helpers.ts
9
- /**
10
- * Type guard to check if an object is a {@link Plugin}
11
- *
12
- * @param value - The object to check
13
- * @returns True if the object is a {@link Plugin}, false otherwise
14
- */
15
- function isPlugin(value) {
16
- return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.api) || "api" in value && isSetObject(value.api)) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && KNOWN_HOOKS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && UNPLUGIN_BUILD_VARIANTS.every((variant) => isUndefined(value[variant]) || variant in value && isSetObject(value[variant]));
17
- }
18
- /**
19
- * Type guard to check if an object is a {@link PluginConfigObject}
20
- *
21
- * @param value - The object to check
22
- * @returns True if the object is a {@link PluginConfigObject}, false otherwise
23
- */
24
- function isPluginConfigObject(value) {
25
- return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
26
- }
27
- /**
28
- * Type guard to check if an object is a {@link PluginConfigTuple}
29
- *
30
- * @param value - The object to check
31
- * @returns True if the object is a {@link PluginConfigTuple}, false otherwise
32
- */
33
- function isPluginConfigTuple(value) {
34
- return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
35
- }
36
- /**
37
- * Type guard to check if an object is a {@link PluginConfig}
38
- *
39
- * @param value - The object to check
40
- * @returns True if the object is a {@link PluginConfig}, false otherwise
41
- */
42
- function isPluginConfig(value) {
43
- return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value) || Array.isArray(value) && value.every((item) => isPluginConfig(item));
44
- }
45
- /**
46
- * Type guard to check if an value is a {@link PluginHook} function
47
- *
48
- * @param value - The value to check
49
- * @returns True if the value is a {@link PluginHook} function, false otherwise
50
- */
51
- function isPluginHookObject(value) {
52
- return isSetObject(value) && "handler" in value && isFunction(value.handler);
53
- }
54
- /**
55
- * Type guard to check if an value is a {@link PluginHook} function
56
- *
57
- * @param value - The value to check
58
- * @returns True if the value is a {@link PluginHook} function, false otherwise
59
- */
60
- function isPluginHookFunction(value) {
61
- return isFunction(value) || isPluginHookObject(value);
62
- }
63
- /**
64
- * Type guard to check if an object is a {@link PluginHook}
65
- *
66
- * @param value - The object to check
67
- * @returns True if the object is a {@link PluginHook}, false otherwise
68
- */
69
- function isPluginHook(value) {
70
- return isPluginHookFunction(value) || isPluginHookObject(value);
71
- }
72
- /**
73
- * Extract the hook handler function from a plugin hook
74
- *
75
- * @param pluginHook - The plugin hook to extract the handler function from
76
- * @returns The hook handler function
77
- */
78
- function getHookHandler(pluginHook) {
79
- return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
80
- }
81
- /**
82
- * Check if a hook is external.
83
- *
84
- * @param hook - The name of the hook to check.
85
- * @returns True if the hook is external, false otherwise.
86
- */
87
- function isHookExternal(hook) {
88
- return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
89
- }
90
- /**
91
- * Check if a plugin should be deduplicated.
92
- *
93
- * @param plugin - The plugin to check
94
- * @param plugins - The list of plugins to check against
95
- * @returns True if the plugin should be deduplicated, false otherwise
96
- */
97
- function checkDedupe(plugin, plugins) {
98
- return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
99
- }
100
- /**
101
- * Add a plugin hook to the hooks list.
102
- *
103
- * @param context - The plugin context
104
- * @param plugin - The plugin to add the hook from
105
- * @param pluginHook - The plugin hook to add
106
- * @param hooksList - The list of hooks to add to
107
- */
108
- function addPluginHook(context, plugin, pluginHook, hooksList) {
109
- if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) hooksList.push(isFunction(pluginHook) ? {
110
- plugin,
111
- handler: getHookHandler(pluginHook).bind(context)
112
- } : {
113
- plugin,
114
- ...pluginHook,
115
- handler: getHookHandler(pluginHook).bind(context)
116
- });
117
- }
118
- /**
119
- * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.
120
- *
121
- * @param config - The plugin configuration to check
122
- * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
123
- */
124
- function findInvalidPluginConfig(config) {
125
- if (isPluginConfig(config)) return null;
126
- if (Array.isArray(config)) {
127
- const invalidItems = [];
128
- config.forEach((item) => {
129
- const invalid = findInvalidPluginConfig(item);
130
- if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
131
- });
132
- return invalidItems.length > 0 ? invalidItems : null;
133
- }
134
- return [JSON.stringify(config, null, 2)];
135
- }
136
-
137
- //#endregion
138
- export { addPluginHook, checkDedupe, findInvalidPluginConfig, getHookHandler, isHookExternal, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook };
@@ -1,36 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_path_replace = require("@stryke/path/replace");
3
-
4
- //#region ../powerlines/src/plugin-utils/paths.ts
5
- /**
6
- * Replaces tokens in the given path string with their corresponding values from the context.
7
- *
8
- * @remarks
9
- * The following tokens are supported:
10
- * - `{workspaceRoot}` - The root directory of the workspace.
11
- * - `{root}` - The root directory of the project (same as `{projectRoot}`).
12
- * - `{projectRoot}` - The root directory of the project (same as `{root}`).
13
- * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
14
- * - `{powerlinesPath}` - The directory where Powerlines is installed.
15
- * - `{cachePath}` - The environment's directory for cached files.
16
- * - `{dataPath}` - The environment's directory for data files.
17
- * - `{logPath}` - The environment's directory for log files.
18
- * - `{tempPath}` - The environment's directory for temporary files.
19
- * - `{configPath}` - The environment's directory for configuration files.
20
- * - `{outputPath}` - The configured output directory for the project.
21
- * - `{buildPath}` - The configured distribution directory for the project.
22
- * - `{artifactsPath}` - The configured directory for build artifacts.
23
- * - `{builtinPath}` - The configured directory for generated built-in plugins.
24
- * - `{entryPath}` - The configured directory for generated entry files.
25
- *
26
- * @param context - The context containing the values for the path tokens.
27
- * @param path - The path string with tokens to replace.
28
- * @returns The path string with tokens replaced by their corresponding values from the context.
29
- */
30
- function replacePathTokens(context, path) {
31
- if (!path) return path;
32
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
33
- }
34
-
35
- //#endregion
36
- exports.replacePathTokens = replacePathTokens;
@@ -1,35 +0,0 @@
1
- import { replacePath } from "@stryke/path/replace";
2
-
3
- //#region ../powerlines/src/plugin-utils/paths.ts
4
- /**
5
- * Replaces tokens in the given path string with their corresponding values from the context.
6
- *
7
- * @remarks
8
- * The following tokens are supported:
9
- * - `{workspaceRoot}` - The root directory of the workspace.
10
- * - `{root}` - The root directory of the project (same as `{projectRoot}`).
11
- * - `{projectRoot}` - The root directory of the project (same as `{root}`).
12
- * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
13
- * - `{powerlinesPath}` - The directory where Powerlines is installed.
14
- * - `{cachePath}` - The environment's directory for cached files.
15
- * - `{dataPath}` - The environment's directory for data files.
16
- * - `{logPath}` - The environment's directory for log files.
17
- * - `{tempPath}` - The environment's directory for temporary files.
18
- * - `{configPath}` - The environment's directory for configuration files.
19
- * - `{outputPath}` - The configured output directory for the project.
20
- * - `{buildPath}` - The configured distribution directory for the project.
21
- * - `{artifactsPath}` - The configured directory for build artifacts.
22
- * - `{builtinPath}` - The configured directory for generated built-in plugins.
23
- * - `{entryPath}` - The configured directory for generated entry files.
24
- *
25
- * @param context - The context containing the values for the path tokens.
26
- * @param path - The path string with tokens to replace.
27
- * @returns The path string with tokens replaced by their corresponding values from the context.
28
- */
29
- function replacePathTokens(context, path) {
30
- if (!path) return path;
31
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
32
- }
33
-
34
- //#endregion
35
- export { replacePathTokens };
@@ -1,104 +0,0 @@
1
- import { ResolvedConfig } from "./resolved.cjs";
2
- import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.cjs";
3
- import { HookKeys, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
4
- import { APIContext, EnvironmentContext, PluginContext } from "./context.cjs";
5
- import { CallHookOptions } from "../internal/helpers/hooks.cjs";
6
-
7
- //#region ../powerlines/src/types/api.d.ts
8
-
9
- /**
10
- * Powerlines API Interface
11
- */
12
- interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
13
- /**
14
- * The Powerlines shared API context
15
- */
16
- context: APIContext<TResolvedConfig>;
17
- /**
18
- * Prepare the Powerlines API
19
- *
20
- * @remarks
21
- * This method will prepare the Powerlines API for use, initializing any necessary resources.
22
- *
23
- * @param inlineConfig - The inline configuration for the prepare command
24
- */
25
- prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
26
- /**
27
- * Create a new Powerlines project
28
- *
29
- * @remarks
30
- * This method will create a new Powerlines project in the current directory.
31
- *
32
- * @param inlineConfig - The inline configuration for the new command
33
- * @returns A promise that resolves when the project has been created
34
- */
35
- new: (inlineConfig: NewInlineConfig) => Promise<void>;
36
- /**
37
- * Clean any previously prepared artifacts
38
- *
39
- * @remarks
40
- * This method will remove the previous Powerlines artifacts from the project.
41
- *
42
- * @param inlineConfig - The inline configuration for the clean command
43
- * @returns A promise that resolves when the clean command has completed
44
- */
45
- clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
46
- /**
47
- * Lint the project source code
48
- *
49
- * @param inlineConfig - The inline configuration for the lint command
50
- * @returns A promise that resolves when the lint command has completed
51
- */
52
- lint: (inlineConfig: LintInlineConfig) => Promise<void>;
53
- /**
54
- * Build the project
55
- *
56
- * @remarks
57
- * This method will build the Powerlines project, generating the necessary artifacts.
58
- *
59
- * @param inlineConfig - The inline configuration for the build command
60
- * @returns A promise that resolves when the build command has completed
61
- */
62
- build: (inlineConfig: BuildInlineConfig) => Promise<void>;
63
- /**
64
- * Prepare the documentation for the project
65
- *
66
- * @param inlineConfig - The inline configuration for the docs command
67
- * @returns A promise that resolves when the documentation generation has completed
68
- */
69
- docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
70
- /**
71
- * Deploy the project source code
72
- *
73
- * @remarks
74
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
75
- *
76
- * @param inlineConfig - The inline configuration for the deploy command
77
- */
78
- deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
79
- /**
80
- * Finalization process
81
- *
82
- * @remarks
83
- * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
84
- *
85
- * @returns A promise that resolves when the finalization process has completed
86
- */
87
- finalize: () => Promise<void>;
88
- /**
89
- * Invokes the configured plugin hooks
90
- *
91
- * @remarks
92
- * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
93
- *
94
- * @param hook - The hook to call
95
- * @param options - The options to provide to the hook
96
- * @param args - The arguments to pass to the hook
97
- * @returns The result of the hook call
98
- */
99
- callHook: <TKey extends HookKeys<PluginContext<TResolvedConfig>>>(hook: TKey, options: CallHookOptions & {
100
- environment?: string | EnvironmentContext<TResolvedConfig>;
101
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
102
- }
103
- //#endregion
104
- export { API };
@@ -1,104 +0,0 @@
1
- import { ResolvedConfig } from "./resolved.mjs";
2
- import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig } from "./config.mjs";
3
- import { HookKeys, InferHookParameters, InferHookReturnType } from "./hooks.mjs";
4
- import { APIContext, EnvironmentContext, PluginContext } from "./context.mjs";
5
- import { CallHookOptions } from "../internal/helpers/hooks.mjs";
6
-
7
- //#region ../powerlines/src/types/api.d.ts
8
-
9
- /**
10
- * Powerlines API Interface
11
- */
12
- interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
13
- /**
14
- * The Powerlines shared API context
15
- */
16
- context: APIContext<TResolvedConfig>;
17
- /**
18
- * Prepare the Powerlines API
19
- *
20
- * @remarks
21
- * This method will prepare the Powerlines API for use, initializing any necessary resources.
22
- *
23
- * @param inlineConfig - The inline configuration for the prepare command
24
- */
25
- prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
26
- /**
27
- * Create a new Powerlines project
28
- *
29
- * @remarks
30
- * This method will create a new Powerlines project in the current directory.
31
- *
32
- * @param inlineConfig - The inline configuration for the new command
33
- * @returns A promise that resolves when the project has been created
34
- */
35
- new: (inlineConfig: NewInlineConfig) => Promise<void>;
36
- /**
37
- * Clean any previously prepared artifacts
38
- *
39
- * @remarks
40
- * This method will remove the previous Powerlines artifacts from the project.
41
- *
42
- * @param inlineConfig - The inline configuration for the clean command
43
- * @returns A promise that resolves when the clean command has completed
44
- */
45
- clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
46
- /**
47
- * Lint the project source code
48
- *
49
- * @param inlineConfig - The inline configuration for the lint command
50
- * @returns A promise that resolves when the lint command has completed
51
- */
52
- lint: (inlineConfig: LintInlineConfig) => Promise<void>;
53
- /**
54
- * Build the project
55
- *
56
- * @remarks
57
- * This method will build the Powerlines project, generating the necessary artifacts.
58
- *
59
- * @param inlineConfig - The inline configuration for the build command
60
- * @returns A promise that resolves when the build command has completed
61
- */
62
- build: (inlineConfig: BuildInlineConfig) => Promise<void>;
63
- /**
64
- * Prepare the documentation for the project
65
- *
66
- * @param inlineConfig - The inline configuration for the docs command
67
- * @returns A promise that resolves when the documentation generation has completed
68
- */
69
- docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
70
- /**
71
- * Deploy the project source code
72
- *
73
- * @remarks
74
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
75
- *
76
- * @param inlineConfig - The inline configuration for the deploy command
77
- */
78
- deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
79
- /**
80
- * Finalization process
81
- *
82
- * @remarks
83
- * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
84
- *
85
- * @returns A promise that resolves when the finalization process has completed
86
- */
87
- finalize: () => Promise<void>;
88
- /**
89
- * Invokes the configured plugin hooks
90
- *
91
- * @remarks
92
- * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
93
- *
94
- * @param hook - The hook to call
95
- * @param options - The options to provide to the hook
96
- * @param args - The arguments to pass to the hook
97
- * @returns The result of the hook call
98
- */
99
- callHook: <TKey extends HookKeys<PluginContext<TResolvedConfig>>>(hook: TKey, options: CallHookOptions & {
100
- environment?: string | EnvironmentContext<TResolvedConfig>;
101
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey> | undefined>;
102
- }
103
- //#endregion
104
- export { API };
@@ -1,4 +0,0 @@
1
- import "./config.mjs";
2
- import "./context.mjs";
3
- import "@babel/core";
4
- import "@babel/helper-plugin-utils";
@@ -1,15 +0,0 @@
1
-
2
- //#region ../powerlines/src/types/build.ts
3
- const UNPLUGIN_BUILD_VARIANTS = [
4
- "rollup",
5
- "webpack",
6
- "rspack",
7
- "vite",
8
- "esbuild",
9
- "farm",
10
- "unloader",
11
- "rolldown"
12
- ];
13
-
14
- //#endregion
15
- exports.UNPLUGIN_BUILD_VARIANTS = UNPLUGIN_BUILD_VARIANTS;
@@ -1,154 +0,0 @@
1
- import { DepOptimizationOptions, UserConfig } from "vite";
2
-
3
- //#region ../powerlines/src/types/build.d.ts
4
-
5
- type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
6
- interface BuildConfig {
7
- /**
8
- * The platform to build the project for
9
- *
10
- * @defaultValue "neutral"
11
- */
12
- platform?: "node" | "browser" | "neutral";
13
- /**
14
- * Array of strings indicating the polyfills to include for the build.
15
- *
16
- * @remarks
17
- * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
18
- *
19
- * @example
20
- * ```ts
21
- * {
22
- * polyfill: ['{projectRoot}/custom-polyfill.ts']
23
- * }
24
- * ```
25
- */
26
- polyfill?: string[];
27
- /**
28
- * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
29
- *
30
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
31
- */
32
- mainFields?: string[];
33
- /**
34
- * Array of strings indicating what conditions should be used for module resolution.
35
- */
36
- conditions?: string[];
37
- /**
38
- * Array of strings indicating what file extensions should be used for module resolution.
39
- *
40
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
41
- */
42
- extensions?: string[];
43
- /**
44
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
45
- *
46
- * @remarks
47
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
48
- */
49
- dedupe?: string[];
50
- /**
51
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
52
- */
53
- builtins?: (string | RegExp)[];
54
- /**
55
- * Define global variable replacements.
56
- *
57
- * @remarks
58
- * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
59
- *
60
- * @example
61
- * ```ts
62
- * {
63
- * define: {
64
- * __VERSION__: '"1.0.0"',
65
- * __DEV__: 'process.env.NODE_ENV !== "production"'
66
- * }
67
- * }
68
- * ```
69
- *
70
- * @see https://esbuild.github.io/api/#define
71
- * @see https://vitejs.dev/config/build-options.html#define
72
- * @see https://github.com/rollup/plugins/tree/master/packages/replace
73
- */
74
- define?: Record<string, any>;
75
- /**
76
- * Global variables that will have import statements injected where necessary
77
- *
78
- * @remarks
79
- * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
80
- *
81
- * @example
82
- * ```ts
83
- * {
84
- * inject: {
85
- * process: 'process/browser',
86
- * Buffer: ['buffer', 'Buffer'],
87
- * }
88
- * }
89
- * ```
90
- *
91
- * @see https://github.com/rollup/plugins/tree/master/packages/inject
92
- */
93
- inject?: Record<string, string | string[]>;
94
- /**
95
- * The alias mappings to use for module resolution during the build process.
96
- *
97
- * @remarks
98
- * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
99
- *
100
- * @example
101
- * ```ts
102
- * {
103
- * alias: {
104
- * "@utils": "./src/utils",
105
- * "@components": "./src/components"
106
- * }
107
- * }
108
- * ```
109
- *
110
- * @see https://github.com/rollup/plugins/tree/master/packages/alias
111
- */
112
- alias?: Record<string, string> | Array<{
113
- find: string | RegExp;
114
- replacement: string;
115
- }>;
116
- /**
117
- * A list of modules that should not be bundled, even if they are external dependencies.
118
- *
119
- * @remarks
120
- * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
121
- */
122
- external?: (string | RegExp)[];
123
- /**
124
- * A list of modules that should always be bundled, even if they are external dependencies.
125
- */
126
- noExternal?: (string | RegExp)[];
127
- /**
128
- * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
129
- */
130
- skipNodeModulesBundle?: boolean;
131
- /**
132
- * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
133
- *
134
- * @defaultValue false
135
- */
136
- keepProcessEnv?: boolean;
137
- /**
138
- * An optional set of override options to apply to the selected build variant.
139
- *
140
- * @remarks
141
- * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
142
- */
143
- override?: Record<string, any>;
144
- }
145
- type BuildResolvedConfig = Omit<BuildConfig, "override">;
146
- type ViteBuildConfig = Omit<UserConfig, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
147
- /**
148
- * Optimize deps config
149
- */
150
- optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
151
- };
152
- type ViteResolvedBuildConfig = UserConfig & BuildResolvedConfig;
153
- //#endregion
154
- export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant, ViteBuildConfig, ViteResolvedBuildConfig };