@powerlines/unplugin 0.0.4

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 (119) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +305 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +45 -0
  4. package/dist/_virtual/_rolldown/runtime.mjs +36 -0
  5. package/dist/astro.cjs +37 -0
  6. package/dist/astro.d.cts +27 -0
  7. package/dist/astro.d.cts.map +1 -0
  8. package/dist/astro.d.mts +27 -0
  9. package/dist/astro.d.mts.map +1 -0
  10. package/dist/astro.mjs +36 -0
  11. package/dist/astro.mjs.map +1 -0
  12. package/dist/esbuild.cjs +155 -0
  13. package/dist/esbuild.d.cts +69 -0
  14. package/dist/esbuild.d.cts.map +1 -0
  15. package/dist/esbuild.d.mts +69 -0
  16. package/dist/esbuild.d.mts.map +1 -0
  17. package/dist/esbuild.mjs +149 -0
  18. package/dist/esbuild.mjs.map +1 -0
  19. package/dist/farm.cjs +56 -0
  20. package/dist/farm.d.cts +51 -0
  21. package/dist/farm.d.cts.map +1 -0
  22. package/dist/farm.d.mts +51 -0
  23. package/dist/farm.d.mts.map +1 -0
  24. package/dist/farm.mjs +54 -0
  25. package/dist/farm.mjs.map +1 -0
  26. package/dist/index.cjs +46 -0
  27. package/dist/index.d.cts +37 -0
  28. package/dist/index.d.cts.map +1 -0
  29. package/dist/index.d.mts +37 -0
  30. package/dist/index.d.mts.map +1 -0
  31. package/dist/index.mjs +39 -0
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/next.cjs +37 -0
  34. package/dist/next.d.cts +25 -0
  35. package/dist/next.d.cts.map +1 -0
  36. package/dist/next.d.mts +25 -0
  37. package/dist/next.d.mts.map +1 -0
  38. package/dist/next.mjs +36 -0
  39. package/dist/next.mjs.map +1 -0
  40. package/dist/nuxt.cjs +44 -0
  41. package/dist/nuxt.d.cts +28 -0
  42. package/dist/nuxt.d.cts.map +1 -0
  43. package/dist/nuxt.d.mts +29 -0
  44. package/dist/nuxt.d.mts.map +1 -0
  45. package/dist/nuxt.mjs +44 -0
  46. package/dist/nuxt.mjs.map +1 -0
  47. package/dist/package.cjs +18 -0
  48. package/dist/package.mjs +7 -0
  49. package/dist/package.mjs.map +1 -0
  50. package/dist/rolldown.cjs +161 -0
  51. package/dist/rolldown.d.cts +65 -0
  52. package/dist/rolldown.d.cts.map +1 -0
  53. package/dist/rolldown.d.mts +65 -0
  54. package/dist/rolldown.d.mts.map +1 -0
  55. package/dist/rolldown.mjs +153 -0
  56. package/dist/rolldown.mjs.map +1 -0
  57. package/dist/rollup.cjs +159 -0
  58. package/dist/rollup.d.cts +64 -0
  59. package/dist/rollup.d.cts.map +1 -0
  60. package/dist/rollup.d.mts +64 -0
  61. package/dist/rollup.d.mts.map +1 -0
  62. package/dist/rollup.mjs +149 -0
  63. package/dist/rollup.mjs.map +1 -0
  64. package/dist/rspack.cjs +95 -0
  65. package/dist/rspack.d.cts +58 -0
  66. package/dist/rspack.d.cts.map +1 -0
  67. package/dist/rspack.d.mts +58 -0
  68. package/dist/rspack.d.mts.map +1 -0
  69. package/dist/rspack.mjs +90 -0
  70. package/dist/rspack.mjs.map +1 -0
  71. package/dist/tsdown.cjs +217 -0
  72. package/dist/tsdown.d.cts +63 -0
  73. package/dist/tsdown.d.cts.map +1 -0
  74. package/dist/tsdown.d.mts +63 -0
  75. package/dist/tsdown.d.mts.map +1 -0
  76. package/dist/tsdown.mjs +209 -0
  77. package/dist/tsdown.mjs.map +1 -0
  78. package/dist/tsup.cjs +116 -0
  79. package/dist/tsup.d.cts +49 -0
  80. package/dist/tsup.d.cts.map +1 -0
  81. package/dist/tsup.d.mts +49 -0
  82. package/dist/tsup.d.mts.map +1 -0
  83. package/dist/tsup.mjs +110 -0
  84. package/dist/tsup.mjs.map +1 -0
  85. package/dist/types.cjs +0 -0
  86. package/dist/types.d.cts +12 -0
  87. package/dist/types.d.cts.map +1 -0
  88. package/dist/types.d.mts +12 -0
  89. package/dist/types.d.mts.map +1 -0
  90. package/dist/types.mjs +1 -0
  91. package/dist/unloader.cjs +52 -0
  92. package/dist/unloader.d.cts +46 -0
  93. package/dist/unloader.d.cts.map +1 -0
  94. package/dist/unloader.d.mts +46 -0
  95. package/dist/unloader.d.mts.map +1 -0
  96. package/dist/unloader.mjs +49 -0
  97. package/dist/unloader.mjs.map +1 -0
  98. package/dist/unplugin.cjs +239 -0
  99. package/dist/unplugin.d.cts +60 -0
  100. package/dist/unplugin.d.cts.map +1 -0
  101. package/dist/unplugin.d.mts +60 -0
  102. package/dist/unplugin.d.mts.map +1 -0
  103. package/dist/unplugin.mjs +234 -0
  104. package/dist/unplugin.mjs.map +1 -0
  105. package/dist/vite.cjs +161 -0
  106. package/dist/vite.d.cts +59 -0
  107. package/dist/vite.d.cts.map +1 -0
  108. package/dist/vite.d.mts +59 -0
  109. package/dist/vite.d.mts.map +1 -0
  110. package/dist/vite.mjs +155 -0
  111. package/dist/vite.mjs.map +1 -0
  112. package/dist/webpack.cjs +94 -0
  113. package/dist/webpack.d.cts +58 -0
  114. package/dist/webpack.d.cts.map +1 -0
  115. package/dist/webpack.d.mts +58 -0
  116. package/dist/webpack.d.mts.map +1 -0
  117. package/dist/webpack.mjs +89 -0
  118. package/dist/webpack.mjs.map +1 -0
  119. package/package.json +163 -0
package/dist/vite.cjs ADDED
@@ -0,0 +1,161 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_unplugin = require('./unplugin.cjs');
4
+ const require_esbuild = require('./esbuild.cjs');
5
+ const require_rolldown = require('./rolldown.cjs');
6
+ let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
7
+ let _stryke_path_append = require("@stryke/path/append");
8
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
9
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
10
+ let defu = require("defu");
11
+ defu = require_runtime.__toESM(defu, 1);
12
+ let unplugin = require("unplugin");
13
+
14
+ //#region src/vite.ts
15
+ const DEFAULT_OPTIONS = {
16
+ resolve: { extensions: [
17
+ ".mjs",
18
+ ".js",
19
+ ".mts",
20
+ ".ts",
21
+ ".jsx",
22
+ ".tsx",
23
+ ".json"
24
+ ] },
25
+ json: { stringify: true },
26
+ logLevel: "silent",
27
+ clearScreen: true
28
+ };
29
+ /**
30
+ * Resolves the options for [vite](https://vitejs.dev/).
31
+ *
32
+ * @param context - The build context.
33
+ * @returns The resolved options.
34
+ */
35
+ function resolveOptions(context) {
36
+ return (0, defu.default)({
37
+ define: context.config.define,
38
+ root: (0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd),
39
+ platform: context.config.platform,
40
+ mode: context.config.mode === "development" ? "development" : "production",
41
+ cacheDir: (0, _stryke_path_join_paths.joinPaths)(context.cachePath, "vite"),
42
+ build: {
43
+ minify: context.config.output.minify,
44
+ metafile: context.config.mode === "development",
45
+ sourcemap: context.config.output.sourceMap,
46
+ outDir: (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
47
+ tsconfig: (0, _stryke_path_append.appendPath)(context.tsconfig.tsconfigFilePath, context.config.cwd),
48
+ tsconfigRaw: context.tsconfig.tsconfigJson
49
+ },
50
+ resolve: {
51
+ alias: Object.entries(context.alias).reduce((ret, [id, path]) => {
52
+ if (!ret.find((e) => e.find === id)) ret.push({
53
+ find: id,
54
+ replacement: path
55
+ });
56
+ else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
57
+ return ret;
58
+ }, []),
59
+ dedupe: context.config.resolve.dedupe,
60
+ mainFields: context.config.resolve.mainFields,
61
+ conditions: context.config.resolve.conditions,
62
+ extensions: context.config.resolve.extensions
63
+ },
64
+ esbuild: require_esbuild.resolveOptions(context),
65
+ optimizeDeps: {
66
+ extensions: context.config.resolve.extensions,
67
+ rolldownOptions: require_rolldown.resolveOptions(context),
68
+ esbuildOptions: require_esbuild.resolveOptions(context)
69
+ },
70
+ logLevel: context.config.logLevel.general === "trace" ? "info" : context.config.logLevel.general === "debug" ? "warn" : "error",
71
+ clearScreen: true,
72
+ envDir: context.config.root
73
+ }, DEFAULT_OPTIONS);
74
+ }
75
+ /**
76
+ * Creates a Vite plugin factory that generates a plugin instance.
77
+ *
78
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * // vite.config.ts
83
+ * import { createViteFactory } from "@powerlines/unplugin/vite";
84
+ *
85
+ * const powerlinesPlugin = createViteFactory({ name: "example-app", ... });
86
+ *
87
+ * export default defineConfig({
88
+ * plugins: [powerlinesPlugin()],
89
+ * });
90
+ *
91
+ * ```
92
+ *
93
+ * @param options - The options to create the plugin factory with.
94
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
95
+ * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
96
+ */
97
+ function createViteFactory(options = {}, decorate = (options) => options) {
98
+ return require_unplugin.createUnpluginFactory({
99
+ ...options,
100
+ variant: "vite"
101
+ }, (unplugin$1) => decorate({
102
+ ...unplugin$1,
103
+ vite: {
104
+ sharedDuringBuild: true,
105
+ async hotUpdate(opts) {
106
+ const environment = await unplugin$1.context.getEnvironment();
107
+ return unplugin$1.context.callHook("vite:hotUpdate", { environment }, opts);
108
+ },
109
+ async config(config, env) {
110
+ unplugin$1.context.config.mode = (0, _stryke_env_environment_checks.isDevelopmentMode)(env.mode) ? "development" : (0, _stryke_env_environment_checks.isTestMode)(env.mode) ? "test" : "production";
111
+ const environment = await unplugin$1.context.getEnvironment();
112
+ const result = await unplugin$1.context.callHook("vite:config", { environment }, config, env);
113
+ return (0, defu.default)(resolveOptions(unplugin$1.context), result?.build ?? {}, config);
114
+ },
115
+ async configResolved(_config) {
116
+ const environment = await unplugin$1.context.getEnvironment();
117
+ await unplugin$1.context.callHook("configResolved", { environment });
118
+ },
119
+ async configureServer(server) {
120
+ const environment = await unplugin$1.context.getEnvironment();
121
+ return unplugin$1.context.callHook("vite:configureServer", { environment }, server);
122
+ },
123
+ async configurePreviewServer(server) {
124
+ const environment = await unplugin$1.context.getEnvironment();
125
+ return unplugin$1.context.callHook("vite:configurePreviewServer", { environment }, server);
126
+ },
127
+ async transformIndexHtml(html, ctx) {
128
+ const environment = await unplugin$1.context.getEnvironment();
129
+ return unplugin$1.context.callHook("vite:transformIndexHtml", { environment }, html, ctx);
130
+ },
131
+ async handleHotUpdate(ctx) {
132
+ const environment = await unplugin$1.context.getEnvironment();
133
+ return unplugin$1.context.callHook("vite:handleHotUpdate", { environment }, ctx);
134
+ }
135
+ }
136
+ }));
137
+ }
138
+ /**
139
+ * A Vite plugin that will invoke the Powerlines API hooks during the build process.
140
+ *
141
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * // vite.config.ts
146
+ * import powerlines from "@powerlines/unplugin/vite";
147
+ *
148
+ * export default defineConfig({
149
+ * plugins: [powerlines({ name: "example-app", ... })],
150
+ * });
151
+ *
152
+ * ```
153
+ */
154
+ const plugin = (0, unplugin.createVitePlugin)(createViteFactory());
155
+
156
+ //#endregion
157
+ exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
158
+ exports.createViteFactory = createViteFactory;
159
+ exports.default = plugin;
160
+ exports.plugin = plugin;
161
+ exports.resolveOptions = resolveOptions;
@@ -0,0 +1,59 @@
1
+ import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
+ import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
+ import * as _$_powerlines_core0 from "@powerlines/core";
4
+ import { Context, ExecutionContext } from "@powerlines/core";
5
+ import * as _$vite from "vite";
6
+ import { UserConfig as UserConfig$1 } from "vite";
7
+
8
+ //#region src/vite.d.ts
9
+ declare const DEFAULT_OPTIONS: Partial<UserConfig$1>;
10
+ /**
11
+ * Resolves the options for [vite](https://vitejs.dev/).
12
+ *
13
+ * @param context - The build context.
14
+ * @returns The resolved options.
15
+ */
16
+ declare function resolveOptions(context: Context): UserConfig$1;
17
+ /**
18
+ * Creates a Vite plugin factory that generates a plugin instance.
19
+ *
20
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * // vite.config.ts
25
+ * import { createViteFactory } from "@powerlines/unplugin/vite";
26
+ *
27
+ * const powerlinesPlugin = createViteFactory({ name: "example-app", ... });
28
+ *
29
+ * export default defineConfig({
30
+ * plugins: [powerlinesPlugin()],
31
+ * });
32
+ *
33
+ * ```
34
+ *
35
+ * @param options - The options to create the plugin factory with.
36
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
37
+ * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
38
+ */
39
+ declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<_$_powerlines_core0.ResolvedConfig, unknown>>;
40
+ /**
41
+ * A Vite plugin that will invoke the Powerlines API hooks during the build process.
42
+ *
43
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // vite.config.ts
48
+ * import powerlines from "@powerlines/unplugin/vite";
49
+ *
50
+ * export default defineConfig({
51
+ * plugins: [powerlines({ name: "example-app", ... })],
52
+ * });
53
+ *
54
+ * ```
55
+ */
56
+ declare const plugin: (options?: UnpluginExecutionOptions | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
57
+ //#endregion
58
+ export { DEFAULT_OPTIONS, createViteFactory, plugin as default, plugin, resolveOptions };
59
+ //# sourceMappingURL=vite.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;cAkCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;iBAiBgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA;;;AAAlD;;;;;;;;;AAuFA;;;;;;;;;;;iBAAgB,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;AAqGnE;;cAAa,MAAA,GAAM,OAAA,GAAwC,wBAAA,iBAAxC,MAAA,CAAA,MAAA,QAAA,MAAA,CAAA,MAAA"}
@@ -0,0 +1,59 @@
1
+ import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
2
+ import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
3
+ import * as _$_powerlines_core0 from "@powerlines/core";
4
+ import { Context, ExecutionContext } from "@powerlines/core";
5
+ import * as _$vite from "vite";
6
+ import { UserConfig as UserConfig$1 } from "vite";
7
+
8
+ //#region src/vite.d.ts
9
+ declare const DEFAULT_OPTIONS: Partial<UserConfig$1>;
10
+ /**
11
+ * Resolves the options for [vite](https://vitejs.dev/).
12
+ *
13
+ * @param context - The build context.
14
+ * @returns The resolved options.
15
+ */
16
+ declare function resolveOptions(context: Context): UserConfig$1;
17
+ /**
18
+ * Creates a Vite plugin factory that generates a plugin instance.
19
+ *
20
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * // vite.config.ts
25
+ * import { createViteFactory } from "@powerlines/unplugin/vite";
26
+ *
27
+ * const powerlinesPlugin = createViteFactory({ name: "example-app", ... });
28
+ *
29
+ * export default defineConfig({
30
+ * plugins: [powerlinesPlugin()],
31
+ * });
32
+ *
33
+ * ```
34
+ *
35
+ * @param options - The options to create the plugin factory with.
36
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
37
+ * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
38
+ */
39
+ declare function createViteFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<_$_powerlines_core0.ResolvedConfig, unknown>>;
40
+ /**
41
+ * A Vite plugin that will invoke the Powerlines API hooks during the build process.
42
+ *
43
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // vite.config.ts
48
+ * import powerlines from "@powerlines/unplugin/vite";
49
+ *
50
+ * export default defineConfig({
51
+ * plugins: [powerlines({ name: "example-app", ... })],
52
+ * });
53
+ *
54
+ * ```
55
+ */
56
+ declare const plugin: (options?: UnpluginExecutionOptions | undefined) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
57
+ //#endregion
58
+ export { DEFAULT_OPTIONS, createViteFactory, plugin as default, plugin, resolveOptions };
59
+ //# sourceMappingURL=vite.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;cAkCa,eAAA,EAAiB,OAAA,CAAQ,YAAA;;;;;AAAtC;;iBAiBgB,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA;;;AAAlD;;;;;;;;;AAuFA;;;;;;;;;;;iBAAgB,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;AAqGnE;;cAAa,MAAA,GAAM,OAAA,GAAwC,wBAAA,iBAAxC,MAAA,CAAA,MAAA,QAAA,MAAA,CAAA,MAAA"}
package/dist/vite.mjs ADDED
@@ -0,0 +1,155 @@
1
+ import { createUnpluginFactory } from "./unplugin.mjs";
2
+ import { resolveOptions as resolveOptions$1 } from "./esbuild.mjs";
3
+ import { resolveOptions as resolveOptions$2 } from "./rolldown.mjs";
4
+ import { isDevelopmentMode, isTestMode } from "@stryke/env/environment-checks";
5
+ import { appendPath } from "@stryke/path/append";
6
+ import { relativePath } from "@stryke/path/file-path-fns";
7
+ import { joinPaths } from "@stryke/path/join-paths";
8
+ import defu from "defu";
9
+ import { createVitePlugin } from "unplugin";
10
+
11
+ //#region src/vite.ts
12
+ const DEFAULT_OPTIONS = {
13
+ resolve: { extensions: [
14
+ ".mjs",
15
+ ".js",
16
+ ".mts",
17
+ ".ts",
18
+ ".jsx",
19
+ ".tsx",
20
+ ".json"
21
+ ] },
22
+ json: { stringify: true },
23
+ logLevel: "silent",
24
+ clearScreen: true
25
+ };
26
+ /**
27
+ * Resolves the options for [vite](https://vitejs.dev/).
28
+ *
29
+ * @param context - The build context.
30
+ * @returns The resolved options.
31
+ */
32
+ function resolveOptions(context) {
33
+ return defu({
34
+ define: context.config.define,
35
+ root: appendPath(context.config.root, context.config.cwd),
36
+ platform: context.config.platform,
37
+ mode: context.config.mode === "development" ? "development" : "production",
38
+ cacheDir: joinPaths(context.cachePath, "vite"),
39
+ build: {
40
+ minify: context.config.output.minify,
41
+ metafile: context.config.mode === "development",
42
+ sourcemap: context.config.output.sourceMap,
43
+ outDir: relativePath(appendPath(context.config.root, context.config.cwd), context.config.output.path),
44
+ tsconfig: appendPath(context.tsconfig.tsconfigFilePath, context.config.cwd),
45
+ tsconfigRaw: context.tsconfig.tsconfigJson
46
+ },
47
+ resolve: {
48
+ alias: Object.entries(context.alias).reduce((ret, [id, path]) => {
49
+ if (!ret.find((e) => e.find === id)) ret.push({
50
+ find: id,
51
+ replacement: path
52
+ });
53
+ else context.warn(`Duplicate alias entry for '${id}' detected. The first entry will be used.`);
54
+ return ret;
55
+ }, []),
56
+ dedupe: context.config.resolve.dedupe,
57
+ mainFields: context.config.resolve.mainFields,
58
+ conditions: context.config.resolve.conditions,
59
+ extensions: context.config.resolve.extensions
60
+ },
61
+ esbuild: resolveOptions$1(context),
62
+ optimizeDeps: {
63
+ extensions: context.config.resolve.extensions,
64
+ rolldownOptions: resolveOptions$2(context),
65
+ esbuildOptions: resolveOptions$1(context)
66
+ },
67
+ logLevel: context.config.logLevel.general === "trace" ? "info" : context.config.logLevel.general === "debug" ? "warn" : "error",
68
+ clearScreen: true,
69
+ envDir: context.config.root
70
+ }, DEFAULT_OPTIONS);
71
+ }
72
+ /**
73
+ * Creates a Vite plugin factory that generates a plugin instance.
74
+ *
75
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * // vite.config.ts
80
+ * import { createViteFactory } from "@powerlines/unplugin/vite";
81
+ *
82
+ * const powerlinesPlugin = createViteFactory({ name: "example-app", ... });
83
+ *
84
+ * export default defineConfig({
85
+ * plugins: [powerlinesPlugin()],
86
+ * });
87
+ *
88
+ * ```
89
+ *
90
+ * @param options - The options to create the plugin factory with.
91
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
92
+ * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.
93
+ */
94
+ function createViteFactory(options = {}, decorate = (options) => options) {
95
+ return createUnpluginFactory({
96
+ ...options,
97
+ variant: "vite"
98
+ }, (unplugin) => decorate({
99
+ ...unplugin,
100
+ vite: {
101
+ sharedDuringBuild: true,
102
+ async hotUpdate(opts) {
103
+ const environment = await unplugin.context.getEnvironment();
104
+ return unplugin.context.callHook("vite:hotUpdate", { environment }, opts);
105
+ },
106
+ async config(config, env) {
107
+ unplugin.context.config.mode = isDevelopmentMode(env.mode) ? "development" : isTestMode(env.mode) ? "test" : "production";
108
+ const environment = await unplugin.context.getEnvironment();
109
+ const result = await unplugin.context.callHook("vite:config", { environment }, config, env);
110
+ return defu(resolveOptions(unplugin.context), result?.build ?? {}, config);
111
+ },
112
+ async configResolved(_config) {
113
+ const environment = await unplugin.context.getEnvironment();
114
+ await unplugin.context.callHook("configResolved", { environment });
115
+ },
116
+ async configureServer(server) {
117
+ const environment = await unplugin.context.getEnvironment();
118
+ return unplugin.context.callHook("vite:configureServer", { environment }, server);
119
+ },
120
+ async configurePreviewServer(server) {
121
+ const environment = await unplugin.context.getEnvironment();
122
+ return unplugin.context.callHook("vite:configurePreviewServer", { environment }, server);
123
+ },
124
+ async transformIndexHtml(html, ctx) {
125
+ const environment = await unplugin.context.getEnvironment();
126
+ return unplugin.context.callHook("vite:transformIndexHtml", { environment }, html, ctx);
127
+ },
128
+ async handleHotUpdate(ctx) {
129
+ const environment = await unplugin.context.getEnvironment();
130
+ return unplugin.context.callHook("vite:handleHotUpdate", { environment }, ctx);
131
+ }
132
+ }
133
+ }));
134
+ }
135
+ /**
136
+ * A Vite plugin that will invoke the Powerlines API hooks during the build process.
137
+ *
138
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-api
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * // vite.config.ts
143
+ * import powerlines from "@powerlines/unplugin/vite";
144
+ *
145
+ * export default defineConfig({
146
+ * plugins: [powerlines({ name: "example-app", ... })],
147
+ * });
148
+ *
149
+ * ```
150
+ */
151
+ const plugin = createVitePlugin(createViteFactory());
152
+
153
+ //#endregion
154
+ export { DEFAULT_OPTIONS, createViteFactory, plugin as default, plugin, resolveOptions };
155
+ //# sourceMappingURL=vite.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.mjs","names":["resolveEsbuildOptions","resolveRolldownOptions"],"sources":["../src/vite.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, ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { ESBuildOptions, UserConfig } from \"vite\";\nimport { resolveOptions as resolveEsbuildOptions } from \"./esbuild\";\nimport { resolveOptions as resolveRolldownOptions } from \"./rolldown\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS: Partial<UserConfig> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): UserConfig {\n return defu(\n {\n define: context.config.define,\n root: appendPath(context.config.root, context.config.cwd),\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n outDir: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n resolve: {\n alias: 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 dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n extensions: context.config.resolve.extensions,\n rolldownOptions: resolveRolldownOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"info\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n clearScreen: true,\n envDir: context.config.root\n } as UserConfig,\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Vite plugin factory that generates a plugin instance.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { createViteFactory } from \"@powerlines/unplugin/vite\";\n *\n * const powerlinesPlugin = createViteFactory({ name: \"example-app\", ... });\n *\n * export default defineConfig({\n * plugins: [powerlinesPlugin()],\n * });\n *\n * ```\n *\n * @param options - The options to create the plugin factory with.\n * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.\n * @returns A function that generates a Vite plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Vite build.\n */\nexport function createViteFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"vite\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(opts) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:hotUpdate\",\n { environment },\n opts\n );\n },\n async config(config, env) {\n unplugin.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await unplugin.context.getEnvironment();\n const result = await unplugin.context.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(unplugin.context),\n result?.build ?? {},\n config\n ) as Omit<UserConfig, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await unplugin.context.getEnvironment();\n\n await unplugin.context.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configureServer\",\n { environment },\n server\n );\n },\n async configurePreviewServer(server) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await unplugin.context.getEnvironment();\n\n return unplugin.context.callHook(\n \"vite:handleHotUpdate\",\n { environment },\n ctx\n );\n }\n }\n })\n );\n}\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"@powerlines/unplugin/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createVitePlugin(createViteFactory());\n\nexport default plugin;\n"],"mappings":"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"}
@@ -0,0 +1,94 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_unplugin = require('./unplugin.cjs');
4
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let defu = require("defu");
6
+ defu = require_runtime.__toESM(defu, 1);
7
+ let unplugin = require("unplugin");
8
+
9
+ //#region src/webpack.ts
10
+ /**
11
+ * Resolves the options for [webpack](https://webpack.js.org/).
12
+ *
13
+ * @param context - The build context.
14
+ * @returns The resolved options.
15
+ */
16
+ function resolveOptions(context) {
17
+ return {
18
+ output: { path: context.config.output.path },
19
+ name: context.config.name,
20
+ resolve: { alias: context.alias },
21
+ node: context.config.platform === "node" ? {
22
+ __dirname: true,
23
+ __filename: true,
24
+ global: true
25
+ } : false,
26
+ mode: context.config.mode === "development" ? "development" : "production",
27
+ cache: {
28
+ type: "filesystem",
29
+ cacheDirectory: (0, _stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", "cache")
30
+ },
31
+ recordsInputPath: (0, _stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", ".webpack-records.json"),
32
+ recordsOutputPath: (0, _stryke_path_join_paths.joinPaths)(context.cachePath, "webpack", ".webpack-records.json"),
33
+ context: (0, _stryke_path_join_paths.joinPaths)(context.config.cwd, context.config.root),
34
+ devtool: context.config.output.sourceMap ? "source-map" : false,
35
+ optimization: { minimize: context.config.output.minify }
36
+ };
37
+ }
38
+ /**
39
+ * Creates a Webpack plugin factory that generates a plugin instance.
40
+ *
41
+ * @see https://webpack.js.org/api/plugins/
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * // webpack.config.ts
46
+ * import { createWebpackFactory } from "@powerlines/unplugin/webpack";
47
+ *
48
+ * const powerlinesPlugin = createWebpackFactory({ name: "example-app", ... });
49
+ *
50
+ * export default defineConfig({
51
+ * plugins: [powerlinesPlugin()],
52
+ * });
53
+ *
54
+ * ```
55
+ *
56
+ * @param options - The options to create the plugin factory with.
57
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
58
+ * @returns A function that generates a Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.
59
+ */
60
+ function createWebpackFactory(options = {}, decorate = (options) => options) {
61
+ return require_unplugin.createUnpluginFactory({
62
+ ...options,
63
+ variant: "webpack"
64
+ }, (unplugin$1) => decorate({
65
+ ...unplugin$1,
66
+ webpack(compiler) {
67
+ compiler.hooks.beforeRun.tap("PowerlinesWebpackPlugin", (compiler) => {
68
+ compiler.options = (0, defu.default)(resolveOptions(unplugin$1.context), compiler.options);
69
+ });
70
+ }
71
+ }));
72
+ }
73
+ /**
74
+ * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
75
+ *
76
+ * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture
77
+ *
78
+ * @example
79
+ * ```js
80
+ * // webpack.config.js
81
+ * import powerlines from "@powerlines/unplugin/webpack";
82
+ *
83
+ * export default {
84
+ * plugins: [powerlines({ name: "example-app", ... })],
85
+ * }
86
+ * ```
87
+ */
88
+ const plugin = (0, unplugin.createWebpackPlugin)(createWebpackFactory());
89
+
90
+ //#endregion
91
+ exports.createWebpackFactory = createWebpackFactory;
92
+ exports.default = plugin;
93
+ exports.plugin = plugin;
94
+ exports.resolveOptions = resolveOptions;
@@ -0,0 +1,58 @@
1
+ import { UnpluginExecutionOptions, UnpluginFactory } from "./types.cjs";
2
+ import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
3
+ import * as _$_powerlines_core0 from "@powerlines/core";
4
+ import { Context, ExecutionContext } from "@powerlines/core";
5
+ import { DeepPartial } from "@stryke/types/base";
6
+ import * as _$webpack from "webpack";
7
+ import { WebpackOptionsNormalized } from "webpack";
8
+
9
+ //#region src/webpack.d.ts
10
+ /**
11
+ * Resolves the options for [webpack](https://webpack.js.org/).
12
+ *
13
+ * @param context - The build context.
14
+ * @returns The resolved options.
15
+ */
16
+ declare function resolveOptions(context: Context): DeepPartial<WebpackOptionsNormalized>;
17
+ /**
18
+ * Creates a Webpack plugin factory that generates a plugin instance.
19
+ *
20
+ * @see https://webpack.js.org/api/plugins/
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * // webpack.config.ts
25
+ * import { createWebpackFactory } from "@powerlines/unplugin/webpack";
26
+ *
27
+ * const powerlinesPlugin = createWebpackFactory({ name: "example-app", ... });
28
+ *
29
+ * export default defineConfig({
30
+ * plugins: [powerlinesPlugin()],
31
+ * });
32
+ *
33
+ * ```
34
+ *
35
+ * @param options - The options to create the plugin factory with.
36
+ * @param decorate - A function to decorate the plugin options with additional properties or hooks. This can be used to add custom behavior to the plugin instance, such as additional hooks or configuration options. The function receives the generated plugin options and should return an object containing any additional properties or hooks to be merged into the final plugin options.
37
+ * @returns A function that generates a Webpack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Webpack build.
38
+ */
39
+ declare function createWebpackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<_$_powerlines_core0.ResolvedConfig, unknown>>;
40
+ /**
41
+ * An Webpack plugin that will invoke the Powerlines API hooks during the build process.
42
+ *
43
+ * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture
44
+ *
45
+ * @example
46
+ * ```js
47
+ * // webpack.config.js
48
+ * import powerlines from "@powerlines/unplugin/webpack";
49
+ *
50
+ * export default {
51
+ * plugins: [powerlines({ name: "example-app", ... })],
52
+ * }
53
+ * ```
54
+ */
55
+ declare const plugin: (options?: UnpluginExecutionOptions | undefined) => _$webpack.WebpackPluginInstance;
56
+ //#endregion
57
+ export { createWebpackFactory, plugin as default, plugin, resolveOptions };
58
+ //# sourceMappingURL=webpack.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.d.cts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;;;;;;;;;;;;AAqCA;iBAAgB,cAAA,CACd,OAAA,EAAS,OAAA,GACR,WAAA,CAAY,wBAAA;;;;;;;;;;;;;AAiEf;;;;;;;;;;iBAAgB,oBAAA,kBAAsC,gBAAA,CAAA,CACpD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,CAA/B,mBAAA,CAA+B,cAAA;;;;;;;;;;;;;;;;cAgCtD,MAAA,GAAM,OAAA,GAA8C,wBAAA,iBAA9C,SAAA,CAAA,qBAAA"}