@powerlines/plugin-webpack 0.5.126 → 0.5.128

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 (87) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -1
  2. package/dist/helpers/index.cjs +3 -1
  3. package/dist/helpers/index.mjs +3 -1
  4. package/dist/helpers/unplugin.cjs +12 -1
  5. package/dist/helpers/unplugin.mjs +11 -1
  6. package/dist/index.cjs +39 -1
  7. package/dist/index.mjs +33 -1
  8. package/dist/powerlines/schemas/fs.cjs +226 -1
  9. package/dist/powerlines/schemas/fs.mjs +224 -1
  10. package/dist/powerlines/src/api.cjs +576 -9
  11. package/dist/powerlines/src/api.mjs +578 -1
  12. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +86 -1
  13. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +84 -1
  14. package/dist/powerlines/src/internal/helpers/environment.cjs +52 -1
  15. package/dist/powerlines/src/internal/helpers/environment.mjs +48 -1
  16. package/dist/powerlines/src/internal/helpers/generate-types.cjs +50 -7
  17. package/dist/powerlines/src/internal/helpers/generate-types.mjs +48 -7
  18. package/dist/powerlines/src/internal/helpers/hooks.cjs +63 -1
  19. package/dist/powerlines/src/internal/helpers/hooks.mjs +61 -1
  20. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +25 -3
  21. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +24 -3
  22. package/dist/powerlines/src/internal/helpers/install.cjs +37 -1
  23. package/dist/powerlines/src/internal/helpers/install.mjs +36 -1
  24. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +97 -7
  25. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +93 -7
  26. package/dist/powerlines/src/internal/helpers/resolver.cjs +43 -1
  27. package/dist/powerlines/src/internal/helpers/resolver.mjs +41 -1
  28. package/dist/powerlines/src/lib/build/webpack.cjs +47 -1
  29. package/dist/powerlines/src/lib/build/webpack.mjs +45 -1
  30. package/dist/powerlines/src/lib/config-file.cjs +79 -1
  31. package/dist/powerlines/src/lib/config-file.mjs +76 -1
  32. package/dist/powerlines/src/lib/contexts/api-context.cjs +184 -1
  33. package/dist/powerlines/src/lib/contexts/api-context.mjs +182 -1
  34. package/dist/powerlines/src/lib/contexts/context.cjs +931 -1
  35. package/dist/powerlines/src/lib/contexts/context.mjs +929 -1
  36. package/dist/powerlines/src/lib/contexts/environment-context.cjs +160 -1
  37. package/dist/powerlines/src/lib/contexts/environment-context.mjs +159 -1
  38. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +75 -1
  39. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +74 -1
  40. package/dist/powerlines/src/lib/entry.cjs +69 -1
  41. package/dist/powerlines/src/lib/entry.mjs +67 -1
  42. package/dist/powerlines/src/lib/fs/helpers.cjs +85 -1
  43. package/dist/powerlines/src/lib/fs/helpers.mjs +81 -1
  44. package/dist/powerlines/src/lib/fs/storage/base.cjs +196 -1
  45. package/dist/powerlines/src/lib/fs/storage/base.mjs +195 -1
  46. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +170 -1
  47. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +169 -1
  48. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +88 -1
  49. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +87 -1
  50. package/dist/powerlines/src/lib/fs/vfs.cjs +830 -1
  51. package/dist/powerlines/src/lib/fs/vfs.mjs +828 -1
  52. package/dist/powerlines/src/lib/logger.cjs +58 -1
  53. package/dist/powerlines/src/lib/logger.mjs +55 -1
  54. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +104 -1
  55. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +102 -1
  56. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +149 -4
  57. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +144 -4
  58. package/dist/powerlines/src/lib/unplugin/factory.cjs +6 -1
  59. package/dist/powerlines/src/lib/unplugin/factory.mjs +8 -1
  60. package/dist/powerlines/src/lib/unplugin/helpers.cjs +17 -1
  61. package/dist/powerlines/src/lib/unplugin/helpers.mjs +16 -1
  62. package/dist/powerlines/src/lib/unplugin/index.cjs +3 -1
  63. package/dist/powerlines/src/lib/unplugin/index.mjs +5 -1
  64. package/dist/powerlines/src/lib/unplugin/plugin.cjs +127 -5
  65. package/dist/powerlines/src/lib/unplugin/plugin.mjs +126 -5
  66. package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
  67. package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
  68. package/dist/powerlines/src/lib/utilities/meta.cjs +45 -1
  69. package/dist/powerlines/src/lib/utilities/meta.mjs +41 -1
  70. package/dist/powerlines/src/lib/utilities/source-file.cjs +22 -1
  71. package/dist/powerlines/src/lib/utilities/source-file.mjs +21 -1
  72. package/dist/powerlines/src/plugin-utils/helpers.cjs +148 -1
  73. package/dist/powerlines/src/plugin-utils/helpers.mjs +138 -1
  74. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -1
  75. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -1
  76. package/dist/powerlines/src/types/build.cjs +15 -1
  77. package/dist/powerlines/src/types/build.mjs +14 -1
  78. package/dist/powerlines/src/types/commands.cjs +16 -1
  79. package/dist/powerlines/src/types/commands.mjs +15 -1
  80. package/dist/powerlines/src/types/config.d.mts +1 -0
  81. package/dist/powerlines/src/types/context.d.cts +27 -3
  82. package/dist/powerlines/src/types/context.d.mts +27 -3
  83. package/dist/powerlines/src/types/plugin.cjs +32 -1
  84. package/dist/powerlines/src/types/plugin.mjs +31 -1
  85. package/dist/types/index.mjs +1 -1
  86. package/dist/types/plugin.mjs +1 -1
  87. package/package.json +9 -9
@@ -1 +1,148 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../types/build.cjs`),n=require(`../types/plugin.cjs`);let r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/type-checks/is-set-string`),o=require(`@stryke/type-checks/is-undefined`);function s(e){return(0,i.isSetObject)(e)&&`name`in e&&(0,a.isSetString)(e.name)&&((0,o.isUndefined)(e.api)||`api`in e&&(0,i.isSetObject)(e.api))&&((0,o.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,r.isFunction)(e.applyToEnvironment))&&((0,o.isUndefined)(e.dedupe)||`dedupe`in e&&(0,r.isFunction)(e.dedupe))&&n.KNOWN_HOOKS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(f(e[t])||t===`config`&&(0,i.isSetObject)(e[t])))&&t.UNPLUGIN_BUILD_VARIANTS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(0,i.isSetObject)(e[t]))}function c(e){return(0,i.isSetObject)(e)&&`plugin`in e&&(((0,a.isSetString)(e.plugin)||(0,r.isFunction)(e.plugin))&&`options`in e&&(0,i.isSetObject)(e.options)||s(e.plugin))}function l(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&(((0,a.isSetString)(e[0])||(0,r.isFunction)(e[0]))&&e.length>1&&(0,i.isSetObject)(e[1])||s(e[0]))}function u(e){return(0,a.isSetString)(e)||(0,r.isFunction)(e)||s(e)||c(e)||l(e)||Array.isArray(e)&&e.every(e=>u(e))}function d(e){return(0,i.isSetObject)(e)&&`handler`in e&&(0,r.isFunction)(e.handler)}function f(e){return(0,r.isFunction)(e)||d(e)}function p(e){return f(e)||d(e)}function m(e){return(0,r.isFunction)(e)?e:e.handler}function h(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function g(e,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&((0,r.isFunction)(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function _(e,t,n,i){g(t,i.map(e=>e.plugin))||i.push((0,r.isFunction)(n)?{plugin:t,handler:m(n).bind(e)}:{plugin:t,...n,handler:m(n).bind(e)})}function v(e){if(u(e))return null;if(Array.isArray(e)){let t=[];return e.forEach(e=>{let n=v(e);n&&t.push(...n.map(e=>JSON.stringify(e,null,2)))}),t.length>0?t:null}return[JSON.stringify(e,null,2)]}exports.addPluginHook=_,exports.checkDedupe=g,exports.findInvalidPluginConfig=v,exports.getHookHandler=m,exports.isHookExternal=h,exports.isPlugin=s,exports.isPluginConfig=u,exports.isPluginConfigObject=c,exports.isPluginConfigTuple=l,exports.isPluginHook=p;
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.KNOWN_HOOKS.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.UNPLUGIN_BUILD_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 hook - The name of the hook to check.
86
+ * @returns True if the hook is external, false otherwise.
87
+ */
88
+ function isHookExternal(hook) {
89
+ return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
90
+ }
91
+ /**
92
+ * Check if a plugin should be deduplicated.
93
+ *
94
+ * @param plugin - The plugin to check
95
+ * @param plugins - The list of plugins to check against
96
+ * @returns True if the plugin should be deduplicated, false otherwise
97
+ */
98
+ function checkDedupe(plugin, plugins) {
99
+ 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));
100
+ }
101
+ /**
102
+ * Add a plugin hook to the hooks list.
103
+ *
104
+ * @param context - The plugin context
105
+ * @param plugin - The plugin to add the hook from
106
+ * @param pluginHook - The plugin hook to add
107
+ * @param hooksList - The list of hooks to add to
108
+ */
109
+ function addPluginHook(context, plugin, pluginHook, hooksList) {
110
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) hooksList.push((0, __stryke_type_checks_is_function.isFunction)(pluginHook) ? {
111
+ plugin,
112
+ handler: getHookHandler(pluginHook).bind(context)
113
+ } : {
114
+ plugin,
115
+ ...pluginHook,
116
+ handler: getHookHandler(pluginHook).bind(context)
117
+ });
118
+ }
119
+ /**
120
+ * 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.
121
+ *
122
+ * @param config - The plugin configuration to check
123
+ * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
124
+ */
125
+ function findInvalidPluginConfig(config) {
126
+ if (isPluginConfig(config)) return null;
127
+ if (Array.isArray(config)) {
128
+ const invalidItems = [];
129
+ config.forEach((item) => {
130
+ const invalid = findInvalidPluginConfig(item);
131
+ if (invalid) invalidItems.push(...invalid.map((i) => JSON.stringify(i, null, 2)));
132
+ });
133
+ return invalidItems.length > 0 ? invalidItems : null;
134
+ }
135
+ return [JSON.stringify(config, null, 2)];
136
+ }
137
+
138
+ //#endregion
139
+ exports.addPluginHook = addPluginHook;
140
+ exports.checkDedupe = checkDedupe;
141
+ exports.findInvalidPluginConfig = findInvalidPluginConfig;
142
+ exports.getHookHandler = getHookHandler;
143
+ exports.isHookExternal = isHookExternal;
144
+ exports.isPlugin = isPlugin;
145
+ exports.isPluginConfig = isPluginConfig;
146
+ exports.isPluginConfigObject = isPluginConfigObject;
147
+ exports.isPluginConfigTuple = isPluginConfigTuple;
148
+ exports.isPluginHook = isPluginHook;
@@ -1 +1,138 @@
1
- import{UNPLUGIN_BUILD_VARIANTS as e}from"../types/build.mjs";import{KNOWN_HOOKS as t}from"../types/plugin.mjs";import{isFunction as n}from"@stryke/type-checks/is-function";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{isSetString as i}from"@stryke/type-checks/is-set-string";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(o){return r(o)&&`name`in o&&i(o.name)&&(a(o.api)||`api`in o&&r(o.api))&&(a(o.applyToEnvironment)||`applyToEnvironment`in o&&n(o.applyToEnvironment))&&(a(o.dedupe)||`dedupe`in o&&n(o.dedupe))&&t.every(e=>a(o[e])||e in o&&(d(o[e])||e===`config`&&r(o[e])))&&e.every(e=>a(o[e])||e in o&&r(o[e]))}function s(e){return r(e)&&`plugin`in e&&((i(e.plugin)||n(e.plugin))&&`options`in e&&r(e.options)||o(e.plugin))}function c(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&((i(e[0])||n(e[0]))&&e.length>1&&r(e[1])||o(e[0]))}function l(e){return i(e)||n(e)||o(e)||s(e)||c(e)||Array.isArray(e)&&e.every(e=>l(e))}function u(e){return r(e)&&`handler`in e&&n(e.handler)}function d(e){return n(e)||u(e)}function f(e){return d(e)||u(e)}function p(e){return n(e)?e:e.handler}function m(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function h(e,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&(n(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function g(e,t,r,i){h(t,i.map(e=>e.plugin))||i.push(n(r)?{plugin:t,handler:p(r).bind(e)}:{plugin:t,...r,handler:p(r).bind(e)})}function _(e){if(l(e))return null;if(Array.isArray(e)){let t=[];return e.forEach(e=>{let n=_(e);n&&t.push(...n.map(e=>JSON.stringify(e,null,2)))}),t.length>0?t:null}return[JSON.stringify(e,null,2)]}export{g as addPluginHook,h as checkDedupe,_ as findInvalidPluginConfig,p as getHookHandler,m as isHookExternal,o as isPlugin,l as isPluginConfig,s as isPluginConfigObject,c as isPluginConfigTuple,f as isPluginHook};
1
+ import { UNPLUGIN_BUILD_VARIANTS } from "../types/build.mjs";
2
+ import { KNOWN_HOOKS } 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)) && 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 +1,36 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`);function n(e,n){return n&&n.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,(0,t.replacePath)(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,(0,t.replacePath)(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,(0,t.replacePath)(e.entryPath,e.workspaceConfig.workspaceRoot))}exports.replacePathTokens=n;
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 +1,35 @@
1
- import{replacePath as e}from"@stryke/path/replace";function t(t,n){return n&&n.replaceAll(`{workspaceRoot}`,t.workspaceConfig.workspaceRoot).replaceAll(`{root}`,t.config.projectRoot).replaceAll(`{projectRoot}`,t.config.projectRoot).replaceAll(`{sourceRoot}`,t.config.sourceRoot).replaceAll(`{powerlinesPath}`,t.powerlinesPath).replaceAll(`{cachePath}`,t.cachePath).replaceAll(`{dataPath}`,t.dataPath).replaceAll(`{logPath}`,t.envPaths.log).replaceAll(`{tempPath}`,t.envPaths.temp).replaceAll(`{configPath}`,t.envPaths.config).replaceAll(`{outputPath}`,t.config.output.outputPath).replaceAll(`{buildPath}`,t.config.output.buildPath).replaceAll(`{artifactsPath}`,e(t.artifactsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,e(t.builtinsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,e(t.entryPath,t.workspaceConfig.workspaceRoot))}export{t as replacePathTokens};
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 +1,15 @@
1
- const e=[`rollup`,`webpack`,`rspack`,`vite`,`esbuild`,`farm`,`unloader`,`rolldown`];exports.UNPLUGIN_BUILD_VARIANTS=e;
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 +1,14 @@
1
- const e=[`rollup`,`webpack`,`rspack`,`vite`,`esbuild`,`farm`,`unloader`,`rolldown`];export{e as UNPLUGIN_BUILD_VARIANTS};
1
+ //#region ../powerlines/src/types/build.ts
2
+ const UNPLUGIN_BUILD_VARIANTS = [
3
+ "rollup",
4
+ "webpack",
5
+ "rspack",
6
+ "vite",
7
+ "esbuild",
8
+ "farm",
9
+ "unloader",
10
+ "rolldown"
11
+ ];
12
+
13
+ //#endregion
14
+ export { UNPLUGIN_BUILD_VARIANTS };
@@ -1 +1,16 @@
1
- const e=[`new`,`clean`,`prepare`,`lint`,`test`,`build`,`docs`,`deploy`,`finalize`];exports.SUPPORTED_COMMANDS=e;
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;
@@ -1 +1,15 @@
1
- const e=[`new`,`clean`,`prepare`,`lint`,`test`,`build`,`docs`,`deploy`,`finalize`];export{e as SUPPORTED_COMMANDS};
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 };
@@ -6,6 +6,7 @@ import { TSConfig } from "./tsconfig.mjs";
6
6
  import { PluginContext } from "./context.mjs";
7
7
  import { LogLevelLabel } from "@storm-software/config-tools/types";
8
8
  import { transformAsync } from "@babel/core";
9
+ import "c12";
9
10
  import { PreviewOptions } from "vite";
10
11
  import { MaybePromise } from "@stryke/types/base";
11
12
  import { Format } from "@storm-software/build-tools/types";
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
80
80
  */
81
81
  allowReturnOutsideFunction?: boolean;
82
82
  }
83
+ interface EmitOptions extends WriteOptions {
84
+ /**
85
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
+ */
87
+ emitWithBundler?: boolean;
88
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
+ }
83
91
  /**
84
92
  * Options for emitting entry virtual files
85
93
  */
86
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
94
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
87
95
  /**
88
96
  * The unresolved Powerlines context.
89
97
  *
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
294
302
  * The Powerlines builtin virtual files
295
303
  */
296
304
  getBuiltins: () => Promise<VirtualFile[]>;
305
+ /**
306
+ * Resolves a file and writes it to the VFS if it does not already exist
307
+ *
308
+ * @param code - The source code of the file
309
+ * @param path - The path to write the file to
310
+ * @param options - Additional options for writing the file
311
+ */
312
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
+ /**
314
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
+ *
316
+ * @param code - The source code of the file
317
+ * @param path - The path to write the file to
318
+ * @param options - Additional options for writing the file
319
+ */
320
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
297
321
  /**
298
322
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
299
323
  *
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
302
326
  * @param path - An optional path to write the builtin file to
303
327
  * @param options - Additional options for writing the builtin file
304
328
  */
305
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
329
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
306
330
  /**
307
331
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
308
332
  *
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
335
  * @param path - An optional path to write the builtin file to
312
336
  * @param options - Additional options for writing the builtin file
313
337
  */
314
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
315
339
  /**
316
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
317
341
  *
@@ -1 +1,32 @@
1
- const e=require(`./build.cjs`),t=require(`./commands.cjs`),n=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`],r=[...t.SUPPORTED_COMMANDS,`config`,`configEnvironment`,`configResolved`,`buildStart`,`buildEnd`,`transform`,`load`,`resolveId`,`writeBundle`],i=[...n,...r,...e.UNPLUGIN_BUILD_VARIANTS];exports.KNOWN_HOOKS=r,exports.PLUGIN_NON_HOOK_FIELDS=n;
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 KNOWN_HOOKS = [
13
+ ...require_commands.SUPPORTED_COMMANDS,
14
+ "config",
15
+ "configEnvironment",
16
+ "configResolved",
17
+ "buildStart",
18
+ "buildEnd",
19
+ "transform",
20
+ "load",
21
+ "resolveId",
22
+ "writeBundle"
23
+ ];
24
+ const KNOWN_PLUGIN_FIELDS = [
25
+ ...PLUGIN_NON_HOOK_FIELDS,
26
+ ...KNOWN_HOOKS,
27
+ ...require_build.UNPLUGIN_BUILD_VARIANTS
28
+ ];
29
+
30
+ //#endregion
31
+ exports.KNOWN_HOOKS = KNOWN_HOOKS;
32
+ exports.PLUGIN_NON_HOOK_FIELDS = PLUGIN_NON_HOOK_FIELDS;
@@ -1 +1,31 @@
1
- import{UNPLUGIN_BUILD_VARIANTS as e}from"./build.mjs";import{SUPPORTED_COMMANDS as t}from"./commands.mjs";const n=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`],r=[...t,`config`,`configEnvironment`,`configResolved`,`buildStart`,`buildEnd`,`transform`,`load`,`resolveId`,`writeBundle`];[...n,...r,...e];export{r as KNOWN_HOOKS,n as PLUGIN_NON_HOOK_FIELDS};
1
+ import { UNPLUGIN_BUILD_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 KNOWN_HOOKS = [
13
+ ...SUPPORTED_COMMANDS,
14
+ "config",
15
+ "configEnvironment",
16
+ "configResolved",
17
+ "buildStart",
18
+ "buildEnd",
19
+ "transform",
20
+ "load",
21
+ "resolveId",
22
+ "writeBundle"
23
+ ];
24
+ const KNOWN_PLUGIN_FIELDS = [
25
+ ...PLUGIN_NON_HOOK_FIELDS,
26
+ ...KNOWN_HOOKS,
27
+ ...UNPLUGIN_BUILD_VARIANTS
28
+ ];
29
+
30
+ //#endregion
31
+ export { KNOWN_HOOKS, PLUGIN_NON_HOOK_FIELDS };
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };