@powerlines/plugin-rollup 0.7.232 → 0.7.233

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 (89) hide show
  1. package/dist/helpers/unplugin.cjs +3 -2
  2. package/dist/helpers/unplugin.mjs +2 -1
  3. package/dist/index.cjs +2 -2
  4. package/dist/index.mjs +3 -3
  5. package/dist/powerlines/package.cjs +11 -0
  6. package/dist/powerlines/package.mjs +5 -0
  7. package/dist/powerlines/schemas/fs.cjs +226 -0
  8. package/dist/powerlines/schemas/fs.mjs +224 -0
  9. package/dist/powerlines/src/api.cjs +568 -0
  10. package/dist/powerlines/src/api.mjs +566 -0
  11. package/dist/powerlines/src/internal/helpers/environment.cjs +50 -0
  12. package/dist/powerlines/src/internal/helpers/environment.mjs +47 -0
  13. package/dist/powerlines/src/internal/helpers/generate-types.cjs +78 -0
  14. package/dist/powerlines/src/internal/helpers/generate-types.mjs +76 -0
  15. package/dist/powerlines/src/internal/helpers/hooks.cjs +65 -0
  16. package/dist/powerlines/src/internal/helpers/hooks.mjs +63 -0
  17. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +24 -0
  18. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +23 -0
  19. package/dist/powerlines/src/internal/helpers/install.cjs +36 -0
  20. package/dist/powerlines/src/internal/helpers/install.mjs +35 -0
  21. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +97 -0
  22. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +93 -0
  23. package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -0
  24. package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -0
  25. package/dist/powerlines/src/lib/build/rollup.cjs +126 -0
  26. package/dist/powerlines/src/lib/build/rollup.mjs +119 -0
  27. package/dist/powerlines/src/lib/config-file.cjs +79 -0
  28. package/dist/powerlines/src/lib/config-file.mjs +76 -0
  29. package/dist/powerlines/src/lib/constants/environments.cjs +8 -0
  30. package/dist/powerlines/src/lib/constants/environments.mjs +6 -0
  31. package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -0
  32. package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -0
  33. package/dist/powerlines/src/lib/contexts/context.cjs +951 -0
  34. package/dist/powerlines/src/lib/contexts/context.mjs +949 -0
  35. package/dist/powerlines/src/lib/contexts/environment-context.cjs +195 -0
  36. package/dist/powerlines/src/lib/contexts/environment-context.mjs +194 -0
  37. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +78 -0
  38. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +77 -0
  39. package/dist/powerlines/src/lib/entry.cjs +85 -0
  40. package/dist/powerlines/src/lib/entry.mjs +83 -0
  41. package/dist/powerlines/src/lib/fs/helpers.cjs +85 -0
  42. package/dist/powerlines/src/lib/fs/helpers.mjs +81 -0
  43. package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -0
  44. package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -0
  45. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -0
  46. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -0
  47. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -0
  48. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -0
  49. package/dist/powerlines/src/lib/fs/vfs.cjs +912 -0
  50. package/dist/powerlines/src/lib/fs/vfs.mjs +910 -0
  51. package/dist/powerlines/src/lib/logger.cjs +58 -0
  52. package/dist/powerlines/src/lib/logger.mjs +55 -0
  53. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +103 -0
  54. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +101 -0
  55. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -0
  56. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -0
  57. package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -0
  58. package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -0
  59. package/dist/powerlines/src/lib/unplugin/helpers.cjs +29 -0
  60. package/dist/powerlines/src/lib/unplugin/helpers.mjs +27 -0
  61. package/dist/powerlines/src/lib/unplugin/index.cjs +4 -0
  62. package/dist/powerlines/src/lib/unplugin/index.mjs +6 -0
  63. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +66 -0
  64. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +65 -0
  65. package/dist/powerlines/src/lib/unplugin/plugin.cjs +71 -0
  66. package/dist/powerlines/src/lib/unplugin/plugin.mjs +70 -0
  67. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  68. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  69. package/dist/powerlines/src/lib/utilities/format.cjs +48 -0
  70. package/dist/powerlines/src/lib/utilities/format.mjs +46 -0
  71. package/dist/powerlines/src/lib/utilities/meta.cjs +44 -0
  72. package/dist/powerlines/src/lib/utilities/meta.mjs +40 -0
  73. package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -0
  74. package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -0
  75. package/dist/powerlines/src/plugin-utils/helpers.cjs +167 -0
  76. package/dist/powerlines/src/plugin-utils/helpers.mjs +156 -0
  77. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  78. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  79. package/dist/powerlines/src/types/build.cjs +23 -0
  80. package/dist/powerlines/src/types/build.mjs +21 -0
  81. package/dist/powerlines/src/types/commands.cjs +16 -0
  82. package/dist/powerlines/src/types/commands.mjs +15 -0
  83. package/dist/powerlines/src/types/config.d.mts +2 -1
  84. package/dist/powerlines/src/types/context.d.mts +4 -4
  85. package/dist/powerlines/src/types/fs.d.mts +1 -1
  86. package/dist/powerlines/src/types/plugin.cjs +33 -0
  87. package/dist/powerlines/src/types/plugin.mjs +32 -0
  88. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  89. package/package.json +3 -3
@@ -0,0 +1,167 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_build = require('../types/build.cjs');
3
+ const require_plugin = require('../types/plugin.cjs');
4
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
5
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
7
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
+
9
+ //#region ../powerlines/src/plugin-utils/helpers.ts
10
+ /**
11
+ * Type guard to check if an object is a {@link Plugin}
12
+ *
13
+ * @param value - The object to check
14
+ * @returns True if the object is a {@link Plugin}, false otherwise
15
+ */
16
+ function isPlugin(value) {
17
+ return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "name" in value && (0, __stryke_type_checks_is_set_string.isSetString)(value.name) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.api) || "api" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.api)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.applyToEnvironment) || "applyToEnvironment" in value && (0, __stryke_type_checks_is_function.isFunction)(value.applyToEnvironment)) && ((0, __stryke_type_checks_is_undefined.isUndefined)(value.dedupe) || "dedupe" in value && (0, __stryke_type_checks_is_function.isFunction)(value.dedupe)) && require_plugin.PLUGIN_HOOKS_FIELDS.every((hook) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && (0, __stryke_type_checks_is_set_object.isSetObject)(value[hook]))) && require_build.BUILDER_VARIANTS.every((variant) => (0, __stryke_type_checks_is_undefined.isUndefined)(value[variant]) || variant in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value[variant]));
18
+ }
19
+ /**
20
+ * Type guard to check if an object is a {@link PluginConfigObject}
21
+ *
22
+ * @param value - The object to check
23
+ * @returns True if the object is a {@link PluginConfigObject}, false otherwise
24
+ */
25
+ function isPluginConfigObject(value) {
26
+ return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "plugin" in value && (((0, __stryke_type_checks_is_set_string.isSetString)(value.plugin) || (0, __stryke_type_checks_is_function.isFunction)(value.plugin)) && "options" in value && (0, __stryke_type_checks_is_set_object.isSetObject)(value.options) || isPlugin(value.plugin));
27
+ }
28
+ /**
29
+ * Type guard to check if an object is a {@link PluginConfigTuple}
30
+ *
31
+ * @param value - The object to check
32
+ * @returns True if the object is a {@link PluginConfigTuple}, false otherwise
33
+ */
34
+ function isPluginConfigTuple(value) {
35
+ return Array.isArray(value) && (value.length === 1 || value.length === 2) && (((0, __stryke_type_checks_is_set_string.isSetString)(value[0]) || (0, __stryke_type_checks_is_function.isFunction)(value[0])) && value.length > 1 && (0, __stryke_type_checks_is_set_object.isSetObject)(value[1]) || isPlugin(value[0]));
36
+ }
37
+ /**
38
+ * Type guard to check if an object is a {@link PluginConfig}
39
+ *
40
+ * @param value - The object to check
41
+ * @returns True if the object is a {@link PluginConfig}, false otherwise
42
+ */
43
+ function isPluginConfig(value) {
44
+ return (0, __stryke_type_checks_is_set_string.isSetString)(value) || (0, __stryke_type_checks_is_function.isFunction)(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value) || Array.isArray(value) && value.every((item) => isPluginConfig(item));
45
+ }
46
+ /**
47
+ * Type guard to check if an value is a {@link PluginHook} function
48
+ *
49
+ * @param value - The value to check
50
+ * @returns True if the value is a {@link PluginHook} function, false otherwise
51
+ */
52
+ function isPluginHookObject(value) {
53
+ return (0, __stryke_type_checks_is_set_object.isSetObject)(value) && "handler" in value && (0, __stryke_type_checks_is_function.isFunction)(value.handler);
54
+ }
55
+ /**
56
+ * Type guard to check if an value is a {@link PluginHook} function
57
+ *
58
+ * @param value - The value to check
59
+ * @returns True if the value is a {@link PluginHook} function, false otherwise
60
+ */
61
+ function isPluginHookFunction(value) {
62
+ return (0, __stryke_type_checks_is_function.isFunction)(value) || isPluginHookObject(value);
63
+ }
64
+ /**
65
+ * Type guard to check if an object is a {@link PluginHook}
66
+ *
67
+ * @param value - The object to check
68
+ * @returns True if the object is a {@link PluginHook}, false otherwise
69
+ */
70
+ function isPluginHook(value) {
71
+ return isPluginHookFunction(value) || isPluginHookObject(value);
72
+ }
73
+ /**
74
+ * Extract the hook handler function from a plugin hook
75
+ *
76
+ * @param pluginHook - The plugin hook to extract the handler function from
77
+ * @returns The hook handler function
78
+ */
79
+ function getHookHandler(pluginHook) {
80
+ return (0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? pluginHook : pluginHook.handler;
81
+ }
82
+ /**
83
+ * Check if a hook is external.
84
+ *
85
+ * @param keys - The name of the hook to check.
86
+ * @returns True if the hook is external, false otherwise.
87
+ */
88
+ function isUnpluginHookKey(keys) {
89
+ return require_build.UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
90
+ }
91
+ /**
92
+ * Check if a hook is internal.
93
+ *
94
+ * @param keys - The name of the hook to check.
95
+ * @returns True if the hook is external, false otherwise.
96
+ */
97
+ function isPluginHookField(keys) {
98
+ return !isUnpluginHookKey(keys) && require_plugin.PLUGIN_HOOKS_FIELDS.includes(keys);
99
+ }
100
+ /**
101
+ * Check if a hook is external.
102
+ *
103
+ * @param field - The name of the hook to check.
104
+ * @returns True if the hook is external, false otherwise.
105
+ */
106
+ function isUnpluginHookField(field) {
107
+ return !isPluginHookField(field) && require_build.UNPLUGIN_BUILDER_VARIANTS.includes(field);
108
+ }
109
+ /**
110
+ * Check if a plugin should be deduplicated.
111
+ *
112
+ * @param plugin - The plugin to check
113
+ * @param plugins - The list of plugins to check against
114
+ * @returns True if the plugin should be deduplicated, false otherwise
115
+ */
116
+ function checkDedupe(plugin, plugins) {
117
+ return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && ((0, __stryke_type_checks_is_function.isFunction)(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
118
+ }
119
+ /**
120
+ * Add a plugin hook to the hooks list.
121
+ *
122
+ * @param context - The plugin context
123
+ * @param plugin - The plugin to add the hook from
124
+ * @param pluginHook - The plugin hook to add
125
+ * @param hooksList - The list of hooks to add to
126
+ */
127
+ function addPluginHook(context, plugin, pluginHook, hooksList) {
128
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
129
+ const handler = ((...args) => getHookHandler(pluginHook).apply(context, args));
130
+ if (!handler) return;
131
+ hooksList.push({
132
+ plugin,
133
+ handler
134
+ });
135
+ }
136
+ }
137
+ /**
138
+ * 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.
139
+ *
140
+ * @param config - The plugin configuration to check
141
+ * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
142
+ */
143
+ function findInvalidPluginConfig(config) {
144
+ if (isPluginConfig(config)) return null;
145
+ if (Array.isArray(config)) {
146
+ const invalidItems = [];
147
+ config.forEach((item) => {
148
+ const invalid = findInvalidPluginConfig(item);
149
+ if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
150
+ });
151
+ return invalidItems.length > 0 ? invalidItems : null;
152
+ }
153
+ return [JSON.stringify(config, null, 2)];
154
+ }
155
+
156
+ //#endregion
157
+ exports.addPluginHook = addPluginHook;
158
+ exports.checkDedupe = checkDedupe;
159
+ exports.findInvalidPluginConfig = findInvalidPluginConfig;
160
+ exports.isPlugin = isPlugin;
161
+ exports.isPluginConfig = isPluginConfig;
162
+ exports.isPluginConfigObject = isPluginConfigObject;
163
+ exports.isPluginConfigTuple = isPluginConfigTuple;
164
+ exports.isPluginHook = isPluginHook;
165
+ exports.isPluginHookField = isPluginHookField;
166
+ exports.isUnpluginHookField = isUnpluginHookField;
167
+ exports.isUnpluginHookKey = isUnpluginHookKey;
@@ -0,0 +1,156 @@
1
+ import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from "../types/build.mjs";
2
+ import { PLUGIN_HOOKS_FIELDS } from "../types/plugin.mjs";
3
+ import { isFunction } from "@stryke/type-checks/is-function";
4
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
5
+ import { isSetString } from "@stryke/type-checks/is-set-string";
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)) && PLUGIN_HOOKS_FIELDS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && BUILDER_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 keys - The name of the hook to check.
85
+ * @returns True if the hook is external, false otherwise.
86
+ */
87
+ function isUnpluginHookKey(keys) {
88
+ return UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
89
+ }
90
+ /**
91
+ * Check if a hook is internal.
92
+ *
93
+ * @param keys - The name of the hook to check.
94
+ * @returns True if the hook is external, false otherwise.
95
+ */
96
+ function isPluginHookField(keys) {
97
+ return !isUnpluginHookKey(keys) && PLUGIN_HOOKS_FIELDS.includes(keys);
98
+ }
99
+ /**
100
+ * Check if a hook is external.
101
+ *
102
+ * @param field - The name of the hook to check.
103
+ * @returns True if the hook is external, false otherwise.
104
+ */
105
+ function isUnpluginHookField(field) {
106
+ return !isPluginHookField(field) && UNPLUGIN_BUILDER_VARIANTS.includes(field);
107
+ }
108
+ /**
109
+ * Check if a plugin should be deduplicated.
110
+ *
111
+ * @param plugin - The plugin to check
112
+ * @param plugins - The list of plugins to check against
113
+ * @returns True if the plugin should be deduplicated, false otherwise
114
+ */
115
+ function checkDedupe(plugin, plugins) {
116
+ return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
117
+ }
118
+ /**
119
+ * Add a plugin hook to the hooks list.
120
+ *
121
+ * @param context - The plugin context
122
+ * @param plugin - The plugin to add the hook from
123
+ * @param pluginHook - The plugin hook to add
124
+ * @param hooksList - The list of hooks to add to
125
+ */
126
+ function addPluginHook(context, plugin, pluginHook, hooksList) {
127
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
128
+ const handler = ((...args) => getHookHandler(pluginHook).apply(context, args));
129
+ if (!handler) return;
130
+ hooksList.push({
131
+ plugin,
132
+ handler
133
+ });
134
+ }
135
+ }
136
+ /**
137
+ * 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.
138
+ *
139
+ * @param config - The plugin configuration to check
140
+ * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
141
+ */
142
+ function findInvalidPluginConfig(config) {
143
+ if (isPluginConfig(config)) return null;
144
+ if (Array.isArray(config)) {
145
+ const invalidItems = [];
146
+ config.forEach((item) => {
147
+ const invalid = findInvalidPluginConfig(item);
148
+ if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
149
+ });
150
+ return invalidItems.length > 0 ? invalidItems : null;
151
+ }
152
+ return [JSON.stringify(config, null, 2)];
153
+ }
154
+
155
+ //#endregion
156
+ export { addPluginHook, checkDedupe, findInvalidPluginConfig, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isUnpluginHookField, isUnpluginHookKey };
@@ -0,0 +1,36 @@
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;
@@ -0,0 +1,35 @@
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 };
@@ -0,0 +1,23 @@
1
+
2
+ //#region ../powerlines/src/types/build.ts
3
+ const UNPLUGIN_BUILDER_VARIANTS = [
4
+ "rollup",
5
+ "webpack",
6
+ "rspack",
7
+ "vite",
8
+ "esbuild",
9
+ "farm",
10
+ "unloader",
11
+ "rolldown",
12
+ "bun"
13
+ ];
14
+ const BUILDER_VARIANTS = [
15
+ ...UNPLUGIN_BUILDER_VARIANTS,
16
+ "tsup",
17
+ "tsdown",
18
+ "unbuild"
19
+ ];
20
+
21
+ //#endregion
22
+ exports.BUILDER_VARIANTS = BUILDER_VARIANTS;
23
+ exports.UNPLUGIN_BUILDER_VARIANTS = UNPLUGIN_BUILDER_VARIANTS;
@@ -0,0 +1,21 @@
1
+ //#region ../powerlines/src/types/build.ts
2
+ const UNPLUGIN_BUILDER_VARIANTS = [
3
+ "rollup",
4
+ "webpack",
5
+ "rspack",
6
+ "vite",
7
+ "esbuild",
8
+ "farm",
9
+ "unloader",
10
+ "rolldown",
11
+ "bun"
12
+ ];
13
+ const BUILDER_VARIANTS = [
14
+ ...UNPLUGIN_BUILDER_VARIANTS,
15
+ "tsup",
16
+ "tsdown",
17
+ "unbuild"
18
+ ];
19
+
20
+ //#endregion
21
+ export { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS };
@@ -0,0 +1,16 @@
1
+
2
+ //#region ../powerlines/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,15 @@
1
+ //#region ../powerlines/src/types/commands.ts
2
+ const SUPPORTED_COMMANDS = [
3
+ "new",
4
+ "clean",
5
+ "prepare",
6
+ "lint",
7
+ "test",
8
+ "build",
9
+ "docs",
10
+ "deploy",
11
+ "finalize"
12
+ ];
13
+
14
+ //#endregion
15
+ export { SUPPORTED_COMMANDS };
@@ -4,10 +4,11 @@ import { StoragePort, StoragePreset } from "./fs.mjs";
4
4
  import { Plugin } from "./plugin.mjs";
5
5
  import { TSConfig } from "./tsconfig.mjs";
6
6
  import { PluginContext } from "./context.mjs";
7
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
8
+ import "c12";
7
9
  import { PreviewOptions } from "vite";
8
10
  import { MaybePromise } from "@stryke/types/base";
9
11
  import { Format } from "@storm-software/build-tools/types";
10
- import { LogLevelLabel } from "@storm-software/config-tools/types";
11
12
  import { StormWorkspaceConfig } from "@storm-software/config/types";
12
13
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
13
14
  import { AssetGlob } from "@stryke/types/file";
@@ -7,13 +7,13 @@ import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.mjs";
7
7
  import { ExternalIdResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage } from "unplugin";
8
8
  import { EnvPaths } from "@stryke/env/get-env-paths";
9
9
  import { FetchRequestOptions } from "@stryke/http/fetch";
10
- import { NonUndefined } from "@stryke/types/base";
11
- import { PackageJson } from "@stryke/types/package-json";
10
+ import { ParseResult, ParserOptions } from "oxc-parser";
11
+ import { RequestInfo, Response } from "undici";
12
12
  import { Jiti } from "jiti";
13
13
  import { SourceMap } from "magic-string";
14
- import { ParseResult, ParserOptions } from "oxc-parser";
14
+ import { NonUndefined } from "@stryke/types/base";
15
+ import { PackageJson } from "@stryke/types/package-json";
15
16
  import { Range } from "semver";
16
- import { RequestInfo, Response } from "undici";
17
17
 
18
18
  //#region ../powerlines/src/types/context.d.ts
19
19
 
@@ -1,6 +1,6 @@
1
+ import { ResolveOptions } from "@stryke/fs/resolve";
1
2
  import { MaybePromise } from "@stryke/types/base";
2
3
  import { AssetGlob } from "@stryke/types/file";
3
- import { ResolveOptions } from "@stryke/fs/resolve";
4
4
 
5
5
  //#region ../powerlines/src/types/fs.d.ts
6
6
 
@@ -0,0 +1,33 @@
1
+ const require_build = require('./build.cjs');
2
+ const require_commands = require('./commands.cjs');
3
+
4
+ //#region ../powerlines/src/types/plugin.ts
5
+ const PLUGIN_NON_HOOK_FIELDS = [
6
+ "name",
7
+ "api",
8
+ "enforce",
9
+ "dedupe",
10
+ "applyToEnvironment"
11
+ ];
12
+ const PLUGIN_HOOKS_FIELDS = [
13
+ ...require_commands.SUPPORTED_COMMANDS,
14
+ "config",
15
+ "configEnvironment",
16
+ "configResolved",
17
+ "types",
18
+ "buildStart",
19
+ "buildEnd",
20
+ "transform",
21
+ "load",
22
+ "resolveId",
23
+ "writeBundle"
24
+ ];
25
+ const KNOWN_PLUGIN_FIELDS = [
26
+ ...PLUGIN_NON_HOOK_FIELDS,
27
+ ...PLUGIN_HOOKS_FIELDS,
28
+ ...require_build.BUILDER_VARIANTS
29
+ ];
30
+
31
+ //#endregion
32
+ exports.PLUGIN_HOOKS_FIELDS = PLUGIN_HOOKS_FIELDS;
33
+ exports.PLUGIN_NON_HOOK_FIELDS = PLUGIN_NON_HOOK_FIELDS;
@@ -0,0 +1,32 @@
1
+ import { BUILDER_VARIANTS } from "./build.mjs";
2
+ import { SUPPORTED_COMMANDS } from "./commands.mjs";
3
+
4
+ //#region ../powerlines/src/types/plugin.ts
5
+ const PLUGIN_NON_HOOK_FIELDS = [
6
+ "name",
7
+ "api",
8
+ "enforce",
9
+ "dedupe",
10
+ "applyToEnvironment"
11
+ ];
12
+ const PLUGIN_HOOKS_FIELDS = [
13
+ ...SUPPORTED_COMMANDS,
14
+ "config",
15
+ "configEnvironment",
16
+ "configResolved",
17
+ "types",
18
+ "buildStart",
19
+ "buildEnd",
20
+ "transform",
21
+ "load",
22
+ "resolveId",
23
+ "writeBundle"
24
+ ];
25
+ const KNOWN_PLUGIN_FIELDS = [
26
+ ...PLUGIN_NON_HOOK_FIELDS,
27
+ ...PLUGIN_HOOKS_FIELDS,
28
+ ...BUILDER_VARIANTS
29
+ ];
30
+
31
+ //#endregion
32
+ export { PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS };
@@ -1,5 +1,5 @@
1
- import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
2
1
  import ts from "typescript";
2
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
3
3
 
4
4
  //#region ../powerlines/src/types/tsconfig.d.ts
5
5
  type ReflectionMode = "default" | "explicit" | "never";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-rollup",
3
- "version": "0.7.232",
3
+ "version": "0.7.233",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -157,9 +157,9 @@
157
157
  "unplugin": "3.0.0-beta.3"
158
158
  },
159
159
  "devDependencies": {
160
- "@powerlines/plugin-plugin": "^0.12.173",
160
+ "@powerlines/plugin-plugin": "^0.12.174",
161
161
  "@types/node": "^24.10.9"
162
162
  },
163
163
  "publishConfig": { "access": "public" },
164
- "gitHead": "f7483367fc2dba244e8d11af31db5b1071e0a888"
164
+ "gitHead": "2852dab8ff7cad2d1aa4a44d7fd2479d62f65d47"
165
165
  }