@powerlines/plugin-rolldown 0.7.299 → 0.7.301

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 (67) hide show
  1. package/dist/core/src/lib/logger.mjs +40 -0
  2. package/dist/core/src/lib/logger.mjs.map +1 -0
  3. package/dist/core/src/lib/unplugin/helpers.mjs +19 -0
  4. package/dist/core/src/lib/unplugin/helpers.mjs.map +1 -0
  5. package/dist/core/src/lib/unplugin/index.mjs +5 -0
  6. package/dist/core/src/lib/unplugin/module-resolution.mjs +66 -0
  7. package/dist/core/src/lib/unplugin/module-resolution.mjs.map +1 -0
  8. package/dist/core/src/lib/unplugin/plugin.mjs +71 -0
  9. package/dist/core/src/lib/unplugin/plugin.mjs.map +1 -0
  10. package/dist/core/src/lib/utilities/source-file.mjs +22 -0
  11. package/dist/core/src/lib/utilities/source-file.mjs.map +1 -0
  12. package/dist/core/src/types/api.d.mts +103 -0
  13. package/dist/core/src/types/api.d.mts.map +1 -0
  14. package/dist/core/src/types/commands.d.mts +10 -0
  15. package/dist/core/src/types/commands.d.mts.map +1 -0
  16. package/dist/core/src/types/config.d.mts +551 -0
  17. package/dist/core/src/types/config.d.mts.map +1 -0
  18. package/dist/core/src/types/context.d.mts +511 -0
  19. package/dist/core/src/types/context.d.mts.map +1 -0
  20. package/dist/core/src/types/fs.d.mts +487 -0
  21. package/dist/core/src/types/fs.d.mts.map +1 -0
  22. package/dist/core/src/types/hooks.d.mts +99 -0
  23. package/dist/core/src/types/hooks.d.mts.map +1 -0
  24. package/dist/core/src/types/index.d.mts +9 -0
  25. package/dist/core/src/types/plugin.d.mts +204 -0
  26. package/dist/core/src/types/plugin.d.mts.map +1 -0
  27. package/dist/core/src/types/tsconfig.d.mts +70 -0
  28. package/dist/core/src/types/tsconfig.d.mts.map +1 -0
  29. package/dist/core/src/types/unplugin.d.mts +25 -0
  30. package/dist/core/src/types/unplugin.d.mts.map +1 -0
  31. package/dist/core/src/types/unplugin.mjs +22 -0
  32. package/dist/core/src/types/unplugin.mjs.map +1 -0
  33. package/dist/helpers/index.d.mts +2 -1
  34. package/dist/helpers/index.mjs +2 -1
  35. package/dist/helpers/resolve-options.d.mts +16 -0
  36. package/dist/helpers/resolve-options.d.mts.map +1 -0
  37. package/dist/helpers/resolve-options.mjs +117 -0
  38. package/dist/helpers/resolve-options.mjs.map +1 -0
  39. package/dist/helpers/unplugin.mjs +2 -1
  40. package/dist/helpers/unplugin.mjs.map +1 -1
  41. package/dist/index.d.mts +5 -3
  42. package/dist/index.d.mts.map +1 -1
  43. package/dist/index.mjs +4 -7
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/plugin-rollup/src/helpers/resolve-options.mjs +38 -0
  46. package/dist/plugin-rollup/src/helpers/resolve-options.mjs.map +1 -0
  47. package/dist/types/build.d.mts +8 -0
  48. package/dist/types/build.d.mts.map +1 -0
  49. package/dist/types/build.mjs +1 -0
  50. package/dist/types/index.d.mts +3 -2
  51. package/dist/types/plugin.d.mts +13 -6
  52. package/dist/types/plugin.d.mts.map +1 -1
  53. package/package.json +28 -93
  54. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  55. package/dist/helpers/index.cjs +0 -3
  56. package/dist/helpers/index.d.cts +0 -2
  57. package/dist/helpers/unplugin.cjs +0 -11
  58. package/dist/helpers/unplugin.d.cts +0 -8
  59. package/dist/helpers/unplugin.d.cts.map +0 -1
  60. package/dist/index.cjs +0 -38
  61. package/dist/index.d.cts +0 -14
  62. package/dist/index.d.cts.map +0 -1
  63. package/dist/types/index.cjs +0 -0
  64. package/dist/types/index.d.cts +0 -2
  65. package/dist/types/plugin.cjs +0 -0
  66. package/dist/types/plugin.d.cts +0 -14
  67. package/dist/types/plugin.d.cts.map +0 -1
@@ -0,0 +1,204 @@
1
+ import { CommandType } from "./commands.mjs";
2
+ import { BuilderVariant, InferUnpluginOptions } from "./unplugin.mjs";
3
+ import { BuildPluginContext, PluginContext, UnresolvedContext } from "./context.mjs";
4
+ import { EnvironmentConfig, EnvironmentResolvedConfig, PluginConfig, ResolvedConfig } from "./config.mjs";
5
+ import { ExternalIdResult, HookFilter, TransformResult } from "unplugin";
6
+ import { AnyFunction, MaybePromise } from "@stryke/types/base";
7
+ import { ArrayValues } from "@stryke/types/array";
8
+ import { LoadResult } from "rollup";
9
+
10
+ //#region ../core/src/types/plugin.d.ts
11
+ interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
12
+ /**
13
+ * The order in which the plugin should be applied.
14
+ */
15
+ order?: "pre" | "post" | null | undefined;
16
+ /**
17
+ * A filter to determine when the hook should be called.
18
+ */
19
+ filter?: Pick<HookFilter, TFilter>;
20
+ /**
21
+ * The hook function to be called.
22
+ */
23
+ handler: THookFunction;
24
+ }
25
+ type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
26
+ /**
27
+ * A result returned by the plugin from the `types` hook that describes the declaration types output file.
28
+ */
29
+ interface TypesResult {
30
+ directives?: string[];
31
+ code: string;
32
+ }
33
+ type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & {
34
+ /**
35
+ * A function that returns configuration options to be merged with the build context's options.
36
+ *
37
+ * @remarks
38
+ * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
39
+ *
40
+ * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
41
+ *
42
+ * @see https://vitejs.dev/guide/api-plugin#config
43
+ *
44
+ * @param this - The build context.
45
+ * @param config - The partial configuration object to be modified.
46
+ * @returns A promise that resolves to a partial configuration object.
47
+ */
48
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>;
49
+ /**
50
+ * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
51
+ *
52
+ * @remarks
53
+ * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
54
+ *
55
+ * @see https://vitejs.dev/guide/api-plugin#configenvironment
56
+ *
57
+ * @param this - The build context.
58
+ * @param name - The name of the environment being configured.
59
+ * @param environment - The Vite-like environment object containing information about the current build environment.
60
+ * @returns A promise that resolves when the hook is complete.
61
+ */
62
+ configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
63
+ /**
64
+ * A hook that is called when the plugin is resolved.
65
+ *
66
+ * @see https://vitejs.dev/guide/api-plugin#configresolved
67
+ *
68
+ * @param this - The build context.
69
+ * @returns A promise that resolves when the hook is complete.
70
+ */
71
+ configResolved: (this: TContext) => MaybePromise<void>;
72
+ /**
73
+ * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
74
+ *
75
+ * @param this - The build context.
76
+ * @param code - The source code to generate types for.
77
+ * @returns A promise that resolves when the hook is complete.
78
+ */
79
+ types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
80
+ /**
81
+ * A hook that is called at the start of the build process.
82
+ *
83
+ * @param this - The build context and unplugin build context.
84
+ * @returns A promise that resolves when the hook is complete.
85
+ */
86
+ buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
87
+ /**
88
+ * A hook that is called at the end of the build process.
89
+ *
90
+ * @param this - The build context and unplugin build context.
91
+ * @returns A promise that resolves when the hook is complete.
92
+ */
93
+ buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
94
+ /**
95
+ * A hook that is called to transform the source code.
96
+ *
97
+ * @param this - The build context, unplugin build context, and unplugin context.
98
+ * @param code - The source code to transform.
99
+ * @param id - The identifier of the source code.
100
+ * @returns A promise that resolves when the hook is complete.
101
+ */
102
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
103
+ /**
104
+ * A hook that is called to load the source code.
105
+ *
106
+ * @param this - The build context, unplugin build context, and unplugin context.
107
+ * @param id - The identifier of the source code.
108
+ * @returns A promise that resolves when the hook is complete.
109
+ */
110
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
111
+ /**
112
+ * A hook that is called to resolve the identifier of the source code.
113
+ *
114
+ * @param this - The build context, unplugin build context, and unplugin context.
115
+ * @param id - The identifier of the source code.
116
+ * @param importer - The importer of the source code.
117
+ * @param options - The options for resolving the identifier.
118
+ * @returns A promise that resolves when the hook is complete.
119
+ */
120
+ resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
121
+ isEntry: boolean;
122
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>;
123
+ /**
124
+ * A hook that is called to write the bundle to disk.
125
+ *
126
+ * @param this - The build context.
127
+ * @returns A promise that resolves when the hook is complete.
128
+ */
129
+ writeBundle: (this: TContext) => MaybePromise<void>;
130
+ };
131
+ type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
132
+ transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
133
+ load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
134
+ resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
135
+ };
136
+ type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
137
+ type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
138
+ /**
139
+ * The name of the plugin, for use in deduplication, error messages and logs.
140
+ */
141
+ name: string;
142
+ /**
143
+ * An API object that can be used for inter-plugin communication.
144
+ *
145
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
146
+ */
147
+ api?: Record<string, any>;
148
+ /**
149
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
150
+ *
151
+ * @remarks
152
+ * The Plugin invocation order is as follows:
153
+ * - `enforce: 'pre'` plugins
154
+ * - `order: 'pre'` plugin hooks
155
+ * - any other plugins (normal)
156
+ * - `order: 'post'` plugin hooks
157
+ * - `enforce: 'post'` plugins
158
+ *
159
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
160
+ * @see https://rollupjs.org/plugin-development/#build-hooks
161
+ * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
162
+ * @see https://esbuild.github.io/plugins/#concepts
163
+ */
164
+ enforce?: "pre" | "post";
165
+ /**
166
+ * A function to determine if two plugins are the same and can be de-duplicated.
167
+ *
168
+ * @remarks
169
+ * If this is not provided, plugins are de-duplicated by comparing their names.
170
+ *
171
+ * @param other - The other plugin to compare against.
172
+ * @returns `true` if the two plugins are the same, `false` otherwise.
173
+ */
174
+ dedupe?: false | ((other: Plugin<any>) => boolean);
175
+ /**
176
+ * A list of pre-requisite plugins that must be loaded before this plugin can be used.
177
+ */
178
+ /**
179
+ * Define environments where this plugin should be active. By default, the plugin is active in all environments.
180
+ *
181
+ * @param environment - The environment to check.
182
+ * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
183
+ */
184
+ applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
185
+ /**
186
+ * A function that returns configuration options to be merged with the build context's options.
187
+ *
188
+ * @remarks
189
+ * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
190
+ *
191
+ * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
192
+ *
193
+ * @see https://vitejs.dev/guide/api-plugin#config
194
+ *
195
+ * @param this - The build context.
196
+ * @param config - The partial configuration object to be modified.
197
+ * @returns A promise that resolves to a partial configuration object.
198
+ */
199
+ config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>> | (DeepPartial<TContext["config"]> & Record<string, any>);
200
+ } & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
201
+ type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
202
+ //#endregion
203
+ export { Plugin, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, TypesResult };
204
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../../../core/src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAsCiB,uCACO,mCACA;EAFP;;;EAYD,KAAA,CAAA,EAAA,KAAA,GAAA,MAAA,GAAA,IAAA,GAAA,SAAA;EAAY;;;EAKJ,MAAA,CAAA,EALb,IAKa,CALR,UAKQ,EALI,OAKJ,CAAA;EAGZ;;;EAGR,OAAA,EANO,aAMP;;AAAgD,KAHxC,UAGwC,CAAA,sBAF5B,WAE4B,EAAA,gBAAA,MAD5B,UAC4B,GAAA,KAAA,CAAA,GAAhD,aAAgD,GAAhC,gBAAgC,CAAf,aAAe,EAAA,OAAA,CAAA;;;AAKpD;AAKY,UALK,WAAA,CAKc;EAAkB,UAAA,CAAA,EAAA,MAAA,EAAA;EAC9B,IAAA,EAAA,MAAA;;AAAkC,KADzC,mBACyC,CAAA,iBADJ,aACI,CAAA,GAAA,mBAAlC,WAiBS,GAAA,CAAA,IAAA,EAjBY,QAiBZ,EAAA,GAjByB,YAiBzB,CAAA,IAAA,CAAA,EAAlB,GAAA;EACsB;;;;;;;;;;;;;;EAkDH,MAAA,EAAA,CAAA,IAAA,EAnDnB,iBAmDmB,CAnDD,QAmDC,CAAA,QAAA,CAAA,CAAA,EAAA,GAlDtB,YAkDsB,CAlDT,WAkDS,CAlDG,QAkDH,CA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qGU,CArGG,UAqGH,CAAA;EAmBiB;;;;;;;;;EAGO,SAAA,EAAA,CAAA,IAAA,EA/G/B,kBA+G+B,CA/GZ,QA+GY,CAAA,QAAA,CAAA,CAAA,GA/GU,QA+GV,EAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,GAAA,SAAA,EAAA,OAAA,EAAA;IAEnB,OAAA,EAAA,OAAA;EAClB,CAAA,EAAA,GA9GG,YA8GH,CAAA,MAAA,GA9GyB,gBA8GzB,GAAA,IAAA,GAAA,SAAA,CAAA;EACA;;;AA8BJ;;;EAC4B,WAAA,EAAA,CAAA,IAAA,EAtIN,QAsIM,EAAA,GAtIO,YAsIP,CAAA,IAAA,CAAA;CAApB;AAAmB,KAnIf,WAmIe,CAAA,iBAnIc,aAmId,CAAA,GAAA,wBAlIH,oBAAoB,aAAa,WACrD,oBAAoB,UAAU;aAGrB,WACT,oBAAoB;QAGhB,WAAW,oBAAoB;aAC1B,WAAW,oBAAoB;;KAGvC,+BACS,KAAK,YAAY,EAAE;KAGrB,wBACO,cAAc,kBAAkB,cAAc,mBAC7D,QAAQ,YAAY;;;;;;;;;;QAWhB;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA6BoB;;;;;;;;;;qCAcX,wCACA,aAAa;;;;;;;;;;;;;;;WAiBxB,kBAEU,kBAAkB,wBACrB,aAAa,YAAY,sBAAsB,yBAErD,YAAY,sBAAsB;0BAEnB,kBAAkB,qBACpC,UACA;KA8BQ,kCAAkC,gBAAgB,uBACtD,oBAAoB"}
@@ -0,0 +1,70 @@
1
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
2
+ import ts from "typescript";
3
+
4
+ //#region ../core/src/types/tsconfig.d.ts
5
+ type ReflectionMode = "default" | "explicit" | "never";
6
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
7
+ /**
8
+ * Defines the level of reflection to be used during the transpilation process.
9
+ *
10
+ * @remarks
11
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
12
+ * - `minimal` - Only the essential type information is captured.
13
+ * - `normal` - Additional type information is captured, including some contextual data.
14
+ * - `verbose` - All available type information is captured, including detailed contextual data.
15
+ */
16
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
17
+ interface DeepkitOptions {
18
+ /**
19
+ * Either true to activate reflection for all files compiled using this tsconfig,
20
+ * or a list of globs/file paths relative to this tsconfig.json.
21
+ * Globs/file paths can be prefixed with a ! to exclude them.
22
+ */
23
+ reflection?: RawReflectionMode;
24
+ /**
25
+ * Defines the level of reflection to be used during the transpilation process.
26
+ *
27
+ * @remarks
28
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
29
+ * - `minimal` - Only the essential type information is captured.
30
+ * - `normal` - Additional type information is captured, including some contextual data.
31
+ * - `verbose` - All available type information is captured, including detailed contextual data.
32
+ */
33
+ reflectionLevel?: ReflectionLevel;
34
+ }
35
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
36
+ /**
37
+ * The TypeScript compiler configuration.
38
+ *
39
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
40
+ */
41
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
42
+ /**
43
+ * Either true to activate reflection for all files compiled using this tsconfig,
44
+ * or a list of globs/file paths relative to this tsconfig.json.
45
+ * Globs/file paths can be prefixed with a ! to exclude them.
46
+ */
47
+ reflection?: RawReflectionMode;
48
+ /**
49
+ * Defines the level of reflection to be used during the transpilation process.
50
+ *
51
+ * @remarks
52
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
53
+ * - `minimal` - Only the essential type information is captured.
54
+ * - `normal` - Additional type information is captured, including some contextual data.
55
+ * - `verbose` - All available type information is captured, including detailed contextual data.
56
+ */
57
+ reflectionLevel?: ReflectionLevel;
58
+ /**
59
+ * Instructs the TypeScript compiler how to compile `.ts` files.
60
+ */
61
+ compilerOptions?: TSCompilerOptions;
62
+ }
63
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
64
+ originalTsconfigJson: TsConfigJson;
65
+ tsconfigJson: TSConfig;
66
+ tsconfigFilePath: string;
67
+ };
68
+ //#endregion
69
+ export { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig };
70
+ //# sourceMappingURL=tsconfig.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.d.mts","names":[],"sources":["../../../../../core/src/types/tsconfig.ts"],"sourcesContent":[],"mappings":";;;;KAqBY,cAAA;KACA,iBAAA,GACR;AAFJ;AACA;AAiBA;AAEA;AAoBA;AAOA;;;;AAsBoB,KAnDR,eAAA,GAmDQ,SAAA,GAAA,QAAA,GAAA,SAAA;AAtBc,UA3BjB,cAAA,CA2BiB;EAAI;AAyBtC;;;;EAEwB,UAAA,CAAA,EAhDT,iBAgDS;;;;;;;;;;oBArCJ;;KAGR,iBAAA,GAAoB,kBAAkB;;;;;;UAOjC,QAAA,SAAiB,KAAK;;;;;;eAMxB;;;;;;;;;;oBAWK;;;;oBAKA;;KAGR,sBAAA,GAAyB,EAAA,CAAG;wBAChB;gBACR"}
@@ -0,0 +1,25 @@
1
+ import { PluginHook } from "./plugin.mjs";
2
+ import { Context } from "./context.mjs";
3
+ import "./config.mjs";
4
+ import { API } from "./api.mjs";
5
+ import { HookFilter, UnpluginOptions } from "unplugin";
6
+ import { MaybePromise } from "@stryke/types/base";
7
+
8
+ //#region ../core/src/types/unplugin.d.ts
9
+ type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
10
+ type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
11
+ type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
12
+ interface UnpluginOptions$1<TContext extends Context = Context> extends UnpluginOptions {
13
+ /**
14
+ * An API object that can be used for inter-plugin communication.
15
+ *
16
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
17
+ */
18
+ api: API<TContext["config"]>;
19
+ }
20
+ type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant> = InferUnpluginVariant<TBuilderVariant>> = { [TKey in keyof Required<UnpluginOptions$1<TContext>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] extends infer THandler | {
21
+ handler: infer THandler;
22
+ } ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] };
23
+ //#endregion
24
+ export { BuilderVariant, InferUnpluginOptions, InferUnpluginVariant, UnpluginBuilderVariant, UnpluginOptions$1 as UnpluginOptions };
25
+ //# sourceMappingURL=unplugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unplugin.d.mts","names":[],"sources":["../../../../../core/src/types/unplugin.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6BY,sBAAA;AAAA,KAuBA,cAAA,GACR,sBAxB8B,GAAA,MAAA,GAAA,QAAA,GAAA,SAAA;AAoCtB,KAAA,oBAAoB,CAAA,sBAAuB,cAAvB,CAAA,GAC9B,aAD8B,SAAA,MAAA,GAAA,SAAA,GAG1B,aAH0B,SAAA,QAAA,GAAA,UAAA,GAKxB,aALwB,SAAA,SAAA,GAAA,QAAA,GAOtB,aAPsB;AAAuB,UAStC,iBATsC,CAAA,iBAUpC,OAVoC,GAU1B,OAV0B,CAAA,SAW7C,eAX6C,CAAA;EACrD;;;;;EAQe,GAAA,EAQV,GARU,CAQN,QARM,CAAA,QAAe,CAAA,CAAA;;AACH,KAUjB,oBAViB,CAAA,iBAWV,OAXU,GAWA,OAXA,EAAA,wBAYH,cAZG,GAYc,cAZd,EAAA,yBAaF,oBAbE,CAamB,eAbnB,CAAA,GAczB,oBAdyB,CAcJ,eAdI,CAAA,CAAA,GAAA,WAOlB,MASM,QATN,CAUP,iBAVO,CAUS,QAVT,CAAA,CAAA,CAWP,gBAXO,CAAA,IAWc,QAXd,CAYP,iBAZO,CAYS,QAZT,CAAA,CAAA,CAaP,gBAbO,CAAA,CAaW,IAbX,CAAA,SAAA,KAAA,SAAA,GAAA;EAAJ,OAAA,EAAA,KAAA,SAAA;AANG,CAAA,GAAA,QAAA,UAAA,CAAA,IAAA,EAAA,KAAA,iBAAA,EAAA,GAAA,IAAA,EAAA,KAAA,MAAA,EAAA,GAAA,KAAA,QAAA,IA4BF,UA5BE,CAAA,CAAA,IAAA,EA8BQ,gBA9BR,GA8B2B,QA9B3B,EAAA,GAAA,IAAA,EA+BW,KA/BX,EAAA,GAgCK,YAhCL,CAgCkB,OAhClB,CAAA,EAAA,MAiCM,UAjCN,CAAA,GAmCF,QAnCE,CAmCO,iBAnCP,CAmCuB,QAnCvB,CAAA,CAAA,CAmCkC,gBAnClC,CAAA,CAmCoD,IAnCpD,CAAA,GAoCJ,QApCI,CAoCK,iBApCL,CAoCqB,QApCrB,CAAA,CAAA,CAoCgC,gBApChC,CAAA,CAoCkD,IApClD,CAAA,EAAmB"}
@@ -0,0 +1,22 @@
1
+ //#region ../core/src/types/unplugin.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 { };
22
+ //# sourceMappingURL=unplugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unplugin.mjs","names":["UNPLUGIN_BUILDER_VARIANTS: UnpluginBuilderVariant[]","BUILDER_VARIANTS: BuilderVariant[]"],"sources":["../../../../../core/src/types/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type {\n UnpluginOptions as BaseUnpluginOptions,\n HookFilter,\n UnpluginContextMeta\n} from \"unplugin\";\nimport type { API } from \"./api\";\nimport type { UserConfig } from \"./config\";\nimport type { Context } from \"./context\";\nimport type { PluginHook } from \"./plugin\";\n\nexport type UnpluginBuilderVariant =\n | \"rollup\"\n | \"webpack\"\n | \"rspack\"\n | \"vite\"\n | \"esbuild\"\n | \"farm\"\n | \"unloader\"\n | \"rolldown\"\n | \"bun\";\n\nexport const UNPLUGIN_BUILDER_VARIANTS: UnpluginBuilderVariant[] = [\n \"rollup\",\n \"webpack\",\n \"rspack\",\n \"vite\",\n \"esbuild\",\n \"farm\",\n \"unloader\",\n \"rolldown\",\n \"bun\"\n] as const;\n\nexport type BuilderVariant =\n | UnpluginBuilderVariant\n | \"tsup\"\n | \"tsdown\"\n | \"unbuild\";\n\nexport const BUILDER_VARIANTS: BuilderVariant[] = [\n ...UNPLUGIN_BUILDER_VARIANTS,\n \"tsup\",\n \"tsdown\",\n \"unbuild\"\n] as const;\n\nexport type InferUnpluginVariant<TBuildVariant extends BuilderVariant> =\n TBuildVariant extends \"tsup\"\n ? \"esbuild\"\n : TBuildVariant extends \"tsdown\"\n ? \"rolldown\"\n : TBuildVariant extends \"unbuild\"\n ? \"rollup\"\n : TBuildVariant;\n\nexport interface UnpluginOptions<\n TContext extends Context = Context\n> extends BaseUnpluginOptions {\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api: API<TContext[\"config\"]>;\n}\n\nexport type InferUnpluginOptions<\n TContext extends Context = Context,\n TBuilderVariant extends BuilderVariant = BuilderVariant,\n TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant> =\n InferUnpluginVariant<TBuilderVariant>\n> = {\n [TKey in keyof Required<\n UnpluginOptions<TContext>\n >[TUnpluginVariant]]?: Required<\n UnpluginOptions<TContext>\n >[TUnpluginVariant][TKey] extends\n | infer THandler\n | {\n handler: infer THandler;\n }\n ? THandler extends (\n this: infer TOriginalContext,\n ...args: infer TArgs\n ) => infer TReturn\n ? PluginHook<\n (\n this: TOriginalContext & TContext,\n ...args: TArgs\n ) => MaybePromise<TReturn>,\n keyof HookFilter\n >\n : Required<UnpluginOptions<TContext>>[TUnpluginVariant][TKey]\n : Required<UnpluginOptions<TContext>>[TUnpluginVariant][TKey];\n};\n\nexport type UnpluginUserConfig = UserConfig & {\n /**\n * The meta information for the unplugin context\n */\n unplugin: UnpluginContextMeta;\n};\n\nexport type UnpluginFactory<TContext extends Context = Context> = (\n options: Partial<TContext[\"config\"][\"userConfig\"]>,\n meta: UnpluginContextMeta\n) => UnpluginOptions<TContext>;\n"],"mappings":";AAwCA,MAAaA,4BAAsD;CACjE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAQD,MAAaC,mBAAqC;CAChD,GAAG;CACH;CACA;CACA;CACD"}
@@ -1,2 +1,3 @@
1
+ import { resolveOptions } from "./resolve-options.mjs";
1
2
  import { createRolldownPlugin } from "./unplugin.mjs";
2
- export { createRolldownPlugin };
3
+ export { createRolldownPlugin, resolveOptions };
@@ -1,3 +1,4 @@
1
+ import { resolveOptions } from "./resolve-options.mjs";
1
2
  import { createRolldownPlugin } from "./unplugin.mjs";
2
3
 
3
- export { createRolldownPlugin };
4
+ export { createRolldownPlugin, resolveOptions };
@@ -0,0 +1,16 @@
1
+ import { Context } from "../core/src/types/context.mjs";
2
+ import "../core/src/types/index.mjs";
3
+ import { RolldownOptions } from "rolldown";
4
+
5
+ //#region src/helpers/resolve-options.d.ts
6
+
7
+ /**
8
+ * Resolves the options for [rolldown](https://rolldown.rs).
9
+ *
10
+ * @param context - The build context.
11
+ * @returns The resolved options.
12
+ */
13
+ declare function resolveOptions(context: Context): RolldownOptions;
14
+ //#endregion
15
+ export { resolveOptions };
16
+ //# sourceMappingURL=resolve-options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.d.mts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AA8CA;;;iBAAgB,cAAA,UAAwB,UAAU"}
@@ -0,0 +1,117 @@
1
+ import { dtsBundlePlugin } from "../plugin-rollup/src/helpers/resolve-options.mjs";
2
+ import { toArray } from "@stryke/convert/to-array";
3
+ import defu from "defu";
4
+ import { getBabelInputPlugin } from "@rollup/plugin-babel";
5
+ import inject from "@rollup/plugin-inject";
6
+ import resolve from "@rollup/plugin-node-resolve";
7
+ import replace from "@rollup/plugin-replace";
8
+ import { joinPaths } from "@stryke/path/join-paths";
9
+ import { isString } from "@stryke/type-checks/is-string";
10
+ import { globSync } from "node:fs";
11
+ import typescriptPlugin from "rollup-plugin-typescript2";
12
+ import { appendPath } from "@stryke/path/append";
13
+ import { viteAliasPlugin } from "rolldown/experimental";
14
+
15
+ //#region src/helpers/resolve-options.ts
16
+ /**
17
+ * Resolves the options for [rolldown](https://rolldown.rs).
18
+ *
19
+ * @param context - The build context.
20
+ * @returns The resolved options.
21
+ */
22
+ function resolveOptions(context) {
23
+ return defu({
24
+ input: globSync(toArray(context.entry).map((entry) => isString(entry) ? entry : entry.file)).flat(),
25
+ external: (source) => {
26
+ if (context.config.resolve.external && toArray(context.config.resolve.external).includes(source)) return true;
27
+ if (context.config.resolve.noExternal && toArray(context.config.resolve.noExternal).includes(source)) return false;
28
+ if (context.builtins.includes(source)) return context.config.projectType !== "application";
29
+ return !context.config.resolve.skipNodeModulesBundle;
30
+ },
31
+ plugins: [
32
+ typescriptPlugin({
33
+ check: false,
34
+ tsconfig: context.tsconfig.tsconfigFilePath
35
+ }),
36
+ context.config.define && Object.keys(context.config.define).length > 0 && replace({
37
+ sourceMap: context.config.mode === "development",
38
+ preventAssignment: true,
39
+ ...context.config.define ?? {}
40
+ }),
41
+ context.config.inject && Object.keys(context.config.inject).length > 0 && inject({
42
+ sourceMap: context.config.mode === "development",
43
+ ...context.config.inject
44
+ }),
45
+ viteAliasPlugin({ entries: Object.entries(context.alias).reduce((ret, [id, path]) => {
46
+ if (!ret.find((e) => e.find === id)) ret.push({
47
+ find: id,
48
+ replacement: path
49
+ });
50
+ else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
51
+ return ret;
52
+ }, []) }),
53
+ context.config.babel && getBabelInputPlugin(defu(context.config.babel, {
54
+ caller: {
55
+ name: "powerlines",
56
+ supportsStaticESM: true
57
+ },
58
+ cwd: context.config.root,
59
+ babelrc: false,
60
+ extensions: [
61
+ ".js",
62
+ ".jsx",
63
+ ".ts",
64
+ ".tsx"
65
+ ],
66
+ babelHelpers: "bundled",
67
+ skipPreflightCheck: true,
68
+ exclude: /node_modules/
69
+ })),
70
+ resolve({
71
+ moduleDirectories: ["node_modules"],
72
+ preferBuiltins: true
73
+ }),
74
+ dtsBundlePlugin
75
+ ]
76
+ }, context.config?.rolldown ? context.config?.rolldown : {}, context.config?.rollup ? context.config?.rollup : {}, {
77
+ resolve: {
78
+ alias: context.alias,
79
+ mainFields: context.config.resolve.mainFields,
80
+ conditions: context.config.resolve.conditions,
81
+ define: context.config.define,
82
+ extensions: context.config.resolve.extensions
83
+ },
84
+ transform: {
85
+ define: context.config.define,
86
+ inject: context.config.inject
87
+ },
88
+ platform: context.config.platform,
89
+ tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.workspaceConfig.workspaceRoot),
90
+ cache: !context.config.skipCache ? joinPaths(context.cachePath, "rolldown") : false,
91
+ logLevel: context.config.logLevel,
92
+ onLog(level, log) {
93
+ if (log.message?.trim()) context.log(level === "info" ? "debug" : level, log.message?.trim() ?? "");
94
+ },
95
+ minify: context.config.mode === "production",
96
+ output: [{
97
+ dir: context.config.output.buildPath,
98
+ format: "es",
99
+ preserveModules: true,
100
+ sourcemap: context.config.mode === "development"
101
+ }, {
102
+ dir: context.config.output.buildPath,
103
+ format: "cjs",
104
+ preserveModules: true,
105
+ sourcemap: context.config.mode === "development"
106
+ }]
107
+ }, {
108
+ keepNames: true,
109
+ treeshake: true,
110
+ shimMissingExports: true,
111
+ transform: { target: "esnext" }
112
+ });
113
+ }
114
+
115
+ //#endregion
116
+ export { resolveOptions };
117
+ //# sourceMappingURL=resolve-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-options.mjs","names":["alias"],"sources":["../../src/helpers/resolve-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Context } from \"@powerlines/core/types\";\nimport { BabelPluginResolvedConfig } from \"@powerlines/plugin-babel/types/plugin\";\nimport { dtsBundlePlugin } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { RollupPluginResolvedConfig } from \"@powerlines/plugin-rollup/types/plugin\";\nimport {\n getBabelInputPlugin,\n RollupBabelInputPluginOptions\n} from \"@rollup/plugin-babel\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { globSync } from \"node:fs\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { RolldownPluginResolvedConfig } from \"../types/plugin\";\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n (context.config as BabelPluginResolvedConfig).babel &&\n getBabelInputPlugin(\n defu((context.config as BabelPluginResolvedConfig).babel, {\n caller: {\n name: \"powerlines\",\n supportsStaticESM: true\n },\n cwd: context.config.root,\n babelrc: false,\n extensions: [\".js\", \".jsx\", \".ts\", \".tsx\"],\n babelHelpers: \"bundled\",\n skipPreflightCheck: true,\n exclude: /node_modules/\n }) as RollupBabelInputPluginOptions\n ),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ]\n },\n (context.config as RolldownPluginResolvedConfig)?.rolldown\n ? (context.config as RolldownPluginResolvedConfig)?.rolldown\n : {},\n (context.config as RollupPluginResolvedConfig)?.rollup\n ? (context.config as RollupPluginResolvedConfig)?.rollup\n : {},\n {\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.workspaceConfig.workspaceRoot\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel: context.config.logLevel,\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (log.message?.trim()) {\n context.log(\n level === \"info\" ? \"debug\" : level,\n log.message?.trim() ?? \"\"\n );\n }\n },\n minify: context.config.mode === \"production\",\n output: [\n {\n dir: context.config.output.buildPath,\n format: \"es\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n },\n {\n dir: context.config.output.buildPath,\n format: \"cjs\",\n preserveModules: true,\n sourcemap: context.config.mode === \"development\"\n }\n ]\n },\n {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\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W,EACT,QAAQ,UACT;EACF,CACF"}
@@ -1,4 +1,5 @@
1
- import { createUnplugin } from "powerlines/lib/unplugin";
1
+ import { createUnplugin } from "../core/src/lib/unplugin/plugin.mjs";
2
+ import "../core/src/lib/unplugin/index.mjs";
2
3
  import { createEsbuildPlugin } from "unplugin";
3
4
 
4
5
  //#region src/helpers/unplugin.ts
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.mjs","names":[],"sources":["../../src/helpers/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { createUnplugin } from \"powerlines/lib/unplugin\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { RolldownPluginContext } from \"../types/plugin\";\n\nexport function createRolldownPlugin(context: RolldownPluginContext) {\n return createEsbuildPlugin(createUnplugin(context))({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,qBAAqB,SAAgC;AACnE,QAAO,oBAAoB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"unplugin.mjs","names":[],"sources":["../../src/helpers/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { RolldownPluginContext } from \"../types/plugin\";\n\nexport function createRolldownPlugin(context: RolldownPluginContext) {\n return createEsbuildPlugin(createUnplugin(context))({});\n}\n"],"mappings":";;;;;AAsBA,SAAgB,qBAAqB,SAAgC;AACnE,QAAO,oBAAoB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC"}
package/dist/index.d.mts CHANGED
@@ -1,8 +1,10 @@
1
- import { RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig } from "./types/plugin.mjs";
1
+ import { Plugin } from "./core/src/types/plugin.mjs";
2
+ import { resolveOptions } from "./helpers/resolve-options.mjs";
3
+ import { RolldownOptions, __ΩRolldownOptions } from "./types/build.mjs";
4
+ import { RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, RolldownPluginUserConfig, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig, __ΩRolldownPluginUserConfig } from "./types/plugin.mjs";
2
5
  import { createRolldownPlugin } from "./helpers/unplugin.mjs";
3
6
  import "./helpers/index.mjs";
4
7
  import "./types/index.mjs";
5
- import { Plugin } from "powerlines/types/plugin";
6
8
 
7
9
  //#region src/index.d.ts
8
10
  /**
@@ -10,5 +12,5 @@ import { Plugin } from "powerlines/types/plugin";
10
12
  */
11
13
  declare const plugin: <TContext extends RolldownPluginContext = RolldownPluginContext>(options?: RolldownPluginOptions) => Plugin<TContext>;
12
14
  //#endregion
13
- export { RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig, createRolldownPlugin, plugin as default, plugin };
15
+ export { RolldownOptions, RolldownPluginContext, RolldownPluginOptions, RolldownPluginResolvedConfig, RolldownPluginUserConfig, __ΩRolldownOptions, __ΩRolldownPluginContext, __ΩRolldownPluginOptions, __ΩRolldownPluginResolvedConfig, __ΩRolldownPluginUserConfig, createRolldownPlugin, plugin as default, plugin, resolveOptions };
14
16
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAiCa,cAAA,MAqCZ,EAAA,CAAA,iBApCkB,qBAoClB,GApC0C,qBAoC1C,CAAA,CAAA,OAAA,CAAA,EAlCU,qBAkCV,EAAA,GAjCE,MAiCF,CAjCS,QAiCT,CAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;cAoCa,0BACM,wBAAwB,iCAEhC,0BACR,OAAO"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
+ import { resolveOptions } from "./helpers/resolve-options.mjs";
1
2
  import { createRolldownPlugin } from "./helpers/unplugin.mjs";
2
3
  import "./helpers/index.mjs";
3
4
  import { toArray } from "@stryke/convert/to-array";
4
5
  import defu from "defu";
5
- import { extractRolldownConfig } from "powerlines/lib/build/rolldown";
6
6
  import { rolldown } from "rolldown";
7
7
 
8
8
  //#region src/index.ts
@@ -15,14 +15,11 @@ const plugin = (options = {}) => {
15
15
  config() {
16
16
  return {
17
17
  output: { format: ["cjs", "esm"] },
18
- build: {
19
- ...options,
20
- variant: "rolldown"
21
- }
18
+ rolldown: { ...options }
22
19
  };
23
20
  },
24
21
  async build() {
25
- const result = await rolldown(defu({ plugins: [createRolldownPlugin(this)] }, extractRolldownConfig(this)));
22
+ const result = await rolldown(defu({ plugins: [createRolldownPlugin(this)] }, resolveOptions(this)));
26
23
  await Promise.all(toArray(this.config.output.format).map(async (format) => result.write({ format })));
27
24
  }
28
25
  };
@@ -30,5 +27,5 @@ const plugin = (options = {}) => {
30
27
  var src_default = plugin;
31
28
 
32
29
  //#endregion
33
- export { createRolldownPlugin, src_default as default, plugin };
30
+ export { createRolldownPlugin, src_default as default, plugin, resolveOptions };
34
31
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["build"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport defu from \"defu\";\nimport { extractRolldownConfig } from \"powerlines/lib/build/rolldown\";\nimport { RolldownUserConfig } from \"powerlines/types/config\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { rolldown as build } from \"rolldown\";\nimport { createRolldownPlugin } from \"./helpers/unplugin\";\nimport { RolldownPluginContext, RolldownPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends RolldownPluginContext = RolldownPluginContext\n>(\n options: RolldownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"rolldown\",\n config() {\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n build: {\n ...options,\n variant: \"rolldown\"\n }\n } as Partial<RolldownUserConfig>;\n },\n async build() {\n const result = await build(\n defu(\n {\n plugins: [createRolldownPlugin(this)]\n },\n extractRolldownConfig(this)\n )\n );\n\n await Promise.all(\n toArray(this.config.output.format).map(async format =>\n result.write({\n format\n })\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAiCA,MAAa,UAGX,UAAiC,EAAE,KACd;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,OAAO,MAAM,EACvB;IACD,OAAO;KACL,GAAG;KACH,SAAS;KACV;IACF;;EAEH,MAAM,QAAQ;GACZ,MAAM,SAAS,MAAMA,SACnB,KACE,EACE,SAAS,CAAC,qBAAqB,KAAK,CAAC,EACtC,EACD,sBAAsB,KAAK,CAC5B,CACF;AAED,SAAM,QAAQ,IACZ,QAAQ,KAAK,OAAO,OAAO,OAAO,CAAC,IAAI,OAAM,WAC3C,OAAO,MAAM,EACX,QACD,CAAC,CACH,CACF;;EAEJ;;AAGH,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":["build"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core/types/plugin\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport defu from \"defu\";\nimport { rolldown as build } from \"rolldown\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createRolldownPlugin } from \"./helpers/unplugin\";\nimport {\n RolldownPluginContext,\n RolldownPluginOptions,\n RolldownPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends RolldownPluginContext = RolldownPluginContext\n>(\n options: RolldownPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"rolldown\",\n config() {\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n rolldown: {\n ...options\n }\n } as Partial<RolldownPluginResolvedConfig>;\n },\n async build() {\n const result = await build(\n defu(\n {\n plugins: [createRolldownPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n\n await Promise.all(\n toArray(this.config.output.format).map(async format =>\n result.write({\n format\n })\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAoCA,MAAa,UAGX,UAAiC,EAAE,KACd;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,OAAO,MAAM,EACvB;IACD,UAAU,EACR,GAAG,SACJ;IACF;;EAEH,MAAM,QAAQ;GACZ,MAAM,SAAS,MAAMA,SACnB,KACE,EACE,SAAS,CAAC,qBAAqB,KAAK,CAAC,EACtC,EACD,eAAe,KAAK,CACrB,CACF;AAED,SAAM,QAAQ,IACZ,QAAQ,KAAK,OAAO,OAAO,OAAO,CAAC,IAAI,OAAM,WAC3C,OAAO,MAAM,EACX,QACD,CAAC,CACH,CACF;;EAEJ;;AAGH,kBAAe"}