@powerlines/unplugin 0.0.76 → 0.0.78
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.
- package/dist/astro.cjs +0 -19
- package/dist/astro.d.mts +0 -2
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +1 -14
- package/dist/astro.mjs.map +1 -1
- package/dist/{_virtual/_rolldown/runtime.mjs → chunk-BUUfjzRC.mjs} +1 -9
- package/dist/esbuild.cjs +2 -11
- package/dist/esbuild.d.cts +2 -2
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +1 -3
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +0 -8
- package/dist/esbuild.mjs.map +1 -1
- package/dist/farm.cjs +2 -21
- package/dist/farm.d.cts +2 -2
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +1 -3
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +1 -14
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -12
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +1 -20
- package/dist/next.d.mts +0 -2
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +1 -14
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt-DkXJSxfm.mjs +48 -0
- package/dist/nuxt-DkXJSxfm.mjs.map +1 -0
- package/dist/nuxt-m9vkfvXK.cjs +52 -0
- package/dist/nuxt.cjs +3 -59
- package/dist/nuxt.d.mts +0 -2
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +3 -53
- package/dist/rolldown.cjs +6 -27
- package/dist/rolldown.d.cts +2 -2
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +1 -3
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +1 -16
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.cjs +7 -29
- package/dist/rollup.d.cts +2 -2
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +1 -3
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +1 -17
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +3 -24
- package/dist/rspack.d.cts +2 -2
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +1 -3
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +1 -16
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsdown.cjs +3 -26
- package/dist/tsdown.d.mts +0 -2
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +1 -19
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +3 -24
- package/dist/tsup.d.mts +0 -2
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +1 -17
- package/dist/tsup.mjs.map +1 -1
- package/dist/types-CEaXoKbk.d.cts +13 -0
- package/dist/types-CEaXoKbk.d.cts.map +1 -0
- package/dist/types.cjs +0 -21
- package/dist/types.d.cts +2 -11
- package/dist/types.d.mts +0 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +1 -16
- package/dist/unloader.cjs +2 -22
- package/dist/unloader.d.cts +2 -2
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +1 -3
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +1 -15
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin-WjPT9ECw.cjs +296 -0
- package/dist/unplugin.cjs +2 -248
- package/dist/unplugin.d.cts +1 -1
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts +0 -2
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +2 -13
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.cjs +2 -11
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +1 -3
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +0 -8
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +3 -24
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +1 -3
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +1 -16
- package/dist/webpack.mjs.map +1 -1
- package/package.json +12 -76
- package/dist/_virtual/_rolldown/runtime.cjs +0 -53
- package/dist/astro.test.cjs +0 -23
- package/dist/astro.test.d.cts +0 -1
- package/dist/astro.test.d.mts +0 -2
- package/dist/astro.test.mjs +0 -25
- package/dist/astro.test.mjs.map +0 -1
- package/dist/esbuild.test.cjs +0 -32
- package/dist/esbuild.test.d.cts +0 -1
- package/dist/esbuild.test.d.mts +0 -2
- package/dist/esbuild.test.mjs +0 -34
- package/dist/esbuild.test.mjs.map +0 -1
- package/dist/farm.test.cjs +0 -23
- package/dist/farm.test.d.cts +0 -1
- package/dist/farm.test.d.mts +0 -2
- package/dist/farm.test.mjs +0 -25
- package/dist/farm.test.mjs.map +0 -1
- package/dist/index.test.cjs +0 -35
- package/dist/index.test.d.cts +0 -1
- package/dist/index.test.d.mts +0 -2
- package/dist/index.test.mjs +0 -37
- package/dist/index.test.mjs.map +0 -1
- package/dist/next.test.cjs +0 -23
- package/dist/next.test.d.cts +0 -1
- package/dist/next.test.d.mts +0 -2
- package/dist/next.test.mjs +0 -25
- package/dist/next.test.mjs.map +0 -1
- package/dist/nuxt.mjs.map +0 -1
- package/dist/nuxt.test.cjs +0 -23
- package/dist/nuxt.test.d.cts +0 -1
- package/dist/nuxt.test.d.mts +0 -2
- package/dist/nuxt.test.mjs +0 -25
- package/dist/nuxt.test.mjs.map +0 -1
- package/dist/package.cjs +0 -26
- package/dist/package.mjs +0 -15
- package/dist/package.mjs.map +0 -1
- package/dist/rolldown.test.cjs +0 -23
- package/dist/rolldown.test.d.cts +0 -1
- package/dist/rolldown.test.d.mts +0 -2
- package/dist/rolldown.test.mjs +0 -25
- package/dist/rolldown.test.mjs.map +0 -1
- package/dist/rollup.test.cjs +0 -23
- package/dist/rollup.test.d.cts +0 -1
- package/dist/rollup.test.d.mts +0 -2
- package/dist/rollup.test.mjs +0 -25
- package/dist/rollup.test.mjs.map +0 -1
- package/dist/rspack.test.cjs +0 -23
- package/dist/rspack.test.d.cts +0 -1
- package/dist/rspack.test.d.mts +0 -2
- package/dist/rspack.test.mjs +0 -25
- package/dist/rspack.test.mjs.map +0 -1
- package/dist/tsdown.test.cjs +0 -23
- package/dist/tsdown.test.d.cts +0 -1
- package/dist/tsdown.test.d.mts +0 -2
- package/dist/tsdown.test.mjs +0 -25
- package/dist/tsdown.test.mjs.map +0 -1
- package/dist/tsup.test.cjs +0 -23
- package/dist/tsup.test.d.cts +0 -1
- package/dist/tsup.test.d.mts +0 -2
- package/dist/tsup.test.mjs +0 -25
- package/dist/tsup.test.mjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/types.test.cjs +0 -23
- package/dist/types.test.d.cts +0 -1
- package/dist/types.test.d.mts +0 -2
- package/dist/types.test.mjs +0 -25
- package/dist/types.test.mjs.map +0 -1
- package/dist/unloader.test.cjs +0 -23
- package/dist/unloader.test.d.cts +0 -1
- package/dist/unloader.test.d.mts +0 -2
- package/dist/unloader.test.mjs +0 -25
- package/dist/unloader.test.mjs.map +0 -1
- package/dist/unplugin.test.cjs +0 -23
- package/dist/unplugin.test.d.cts +0 -1
- package/dist/unplugin.test.d.mts +0 -2
- package/dist/unplugin.test.mjs +0 -25
- package/dist/unplugin.test.mjs.map +0 -1
- package/dist/vite.test.cjs +0 -26
- package/dist/vite.test.d.cts +0 -1
- package/dist/vite.test.d.mts +0 -2
- package/dist/vite.test.mjs +0 -28
- package/dist/vite.test.mjs.map +0 -1
- package/dist/webpack.test.cjs +0 -23
- package/dist/webpack.test.d.cts +0 -1
- package/dist/webpack.test.d.mts +0 -2
- package/dist/webpack.test.mjs +0 -25
- package/dist/webpack.test.mjs.map +0 -1
package/dist/rspack.cjs
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
11
|
-
const require_unplugin = require('./unplugin.cjs');
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
12
3
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
13
4
|
let defu = require("defu");
|
|
14
|
-
defu =
|
|
5
|
+
defu = require_unplugin.__toESM(defu, 1);
|
|
15
6
|
let unplugin = require("unplugin");
|
|
16
7
|
|
|
17
8
|
//#region src/rspack.ts
|
|
18
|
-
var rspack_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
19
|
-
createRspackFactory: () => createRspackFactory,
|
|
20
|
-
default: () => plugin,
|
|
21
|
-
plugin: () => plugin,
|
|
22
|
-
resolveOptions: () => resolveOptions
|
|
23
|
-
});
|
|
24
9
|
/**
|
|
25
10
|
* Resolves the options for [rspack](https://rspack.rs/).
|
|
26
11
|
*
|
|
@@ -106,10 +91,4 @@ const plugin = (0, unplugin.createRspackPlugin)(createRspackFactory());
|
|
|
106
91
|
exports.createRspackFactory = createRspackFactory;
|
|
107
92
|
exports.default = plugin;
|
|
108
93
|
exports.plugin = plugin;
|
|
109
|
-
exports.resolveOptions = resolveOptions;
|
|
110
|
-
Object.defineProperty(exports, 'rspack_exports', {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return rspack_exports;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
94
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/rspack.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
4
4
|
import { RspackOptionsNormalized } from "@rspack/core";
|
|
@@ -33,7 +33,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
33
33
|
* @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.
|
|
34
34
|
* @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.
|
|
35
35
|
*/
|
|
36
|
-
declare function createRspackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
36
|
+
declare function createRspackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
37
37
|
/**
|
|
38
38
|
* An Rspack plugin that will invoke the Powerlines API hooks during the build process.
|
|
39
39
|
*
|
package/dist/rspack.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.cts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;AAuCA;;;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;AAAuB;AAoElC;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA
|
|
1
|
+
{"version":3,"file":"rspack.d.cts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;AAuCA;;;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;AAAuB;AAoElC;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;;cAiCtD,MAAA,GAAM,OAAA,GAA4C,wBAA5C,oCAAA,oBAAA"}
|
package/dist/rspack.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { UnpluginExecutionOptions, UnpluginFactory } from "./types.mjs";
|
|
4
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.mjs";
|
|
5
3
|
import { ExecutionContext, UnresolvedContext } from "@powerlines/core";
|
|
@@ -35,7 +33,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
35
33
|
* @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.
|
|
36
34
|
* @returns A function that generates a Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.
|
|
37
35
|
*/
|
|
38
|
-
declare function createRspackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
36
|
+
declare function createRspackFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
39
37
|
/**
|
|
40
38
|
* An Rspack plugin that will invoke the Powerlines API hooks during the build process.
|
|
41
39
|
*
|
package/dist/rspack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;;;;;;;AAuCA;;;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,OAAA,CAAQ,uBAAA;;;;;;;;;;;;;AAAuB;AAoElC;;;;;;;;;iBAAgB,mBAAA,kBAAqC,gBAAA,EACnD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;;cAiCtD,MAAA,GAAM,OAAA,GAA4C,wBAA5C,oCAAA,oBAAA"}
|
package/dist/rspack.mjs
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
11
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
12
3
|
import defu from "defu";
|
|
13
4
|
import { createRspackPlugin } from "unplugin";
|
|
14
5
|
|
|
15
6
|
//#region src/rspack.ts
|
|
16
|
-
var rspack_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
-
createRspackFactory: () => createRspackFactory,
|
|
18
|
-
default: () => plugin,
|
|
19
|
-
plugin: () => plugin,
|
|
20
|
-
resolveOptions: () => resolveOptions
|
|
21
|
-
});
|
|
22
7
|
/**
|
|
23
8
|
* Resolves the options for [rspack](https://rspack.rs/).
|
|
24
9
|
*
|
|
@@ -101,5 +86,5 @@ function createRspackFactory(options = {}, decorate = (options) => options) {
|
|
|
101
86
|
const plugin = createRspackPlugin(createRspackFactory());
|
|
102
87
|
|
|
103
88
|
//#endregion
|
|
104
|
-
export { createRspackFactory, plugin as default, plugin, resolveOptions
|
|
89
|
+
export { createRspackFactory, plugin as default, plugin, resolveOptions };
|
|
105
90
|
//# sourceMappingURL=rspack.mjs.map
|
package/dist/rspack.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.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 {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ 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 Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.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 {\n ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { RspackOptionsNormalized } from \"@rspack/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { createRspackPlugin, RspackCompiler } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Resolves the options for [rspack](https://rspack.rs/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Partial<RspackOptionsNormalized> {\n return {\n output: {\n path: context.config.output.path\n },\n name: context.config.name,\n resolve: {\n alias: context.alias\n },\n external: context.config.resolve.external,\n noExternal: [\n ...(context.config.resolve.noExternal ?? []),\n ...(context.builtins ?? [])\n ],\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle,\n node:\n context.config.platform === \"node\"\n ? {\n __dirname: true,\n __filename: true,\n global: true\n }\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n recordsInputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"rspack\",\n \".rspack-records.json\"\n ),\n context: joinPaths(context.config.cwd, context.config.root),\n cache: context.config.mode === \"development\",\n devtool: context.config.output.sourceMap ? \"source-map\" : false,\n optimization: {\n minimize: context.config.output.minify\n }\n } as Partial<RspackOptionsNormalized>;\n}\n\n/**\n * Creates a Rspack plugin factory that generates a plugin instance.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n * import { createRspackFactory } from \"@powerlines/unplugin/rspack\";\n *\n * const powerlinesPlugin = createRspackFactory({ 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 Rspack plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rspack build.\n */\nexport function createRspackFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rspack\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rspack(compiler: RspackCompiler) {\n compiler.hooks.beforeRun.tap(\"PowerlinesRspackPlugin\", compiler => {\n compiler.options = defu(\n resolveOptions(unplugin.context),\n compiler.options\n ) as RspackOptionsNormalized;\n });\n }\n })\n );\n}\n\n/**\n * An Rspack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rspack.dev/concepts/plugins\n *\n * @example\n * ```ts\n * // rspack.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rspack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const plugin = createRspackPlugin(createRspackFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAuCA,SAAgB,eACd,SACkC;CAClC,OAAO;EACL,QAAQ,EACN,MAAM,QAAQ,OAAO,OAAO,KAC9B;EACA,MAAM,QAAQ,OAAO;EACrB,SAAS,EACP,OAAO,QAAQ,MACjB;EACA,UAAU,QAAQ,OAAO,QAAQ;EACjC,YAAY,CACV,GAAI,QAAQ,OAAO,QAAQ,cAAc,CAAC,GAC1C,GAAI,QAAQ,YAAY,CAAC,CAC3B;EACA,uBAAuB,QAAQ,OAAO,QAAQ;EAC9C,MACE,QAAQ,OAAO,aAAa,SACxB;GACE,WAAW;GACX,YAAY;GACZ,QAAQ;EACV,IACA;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,kBAAkB,UAChB,QAAQ,WACR,UACA,sBACF;EACA,mBAAmB,UACjB,QAAQ,WACR,UACA,sBACF;EACA,SAAS,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI;EAC1D,OAAO,QAAQ,OAAO,SAAS;EAC/B,SAAS,QAAQ,OAAO,OAAO,YAAY,eAAe;EAC1D,cAAc,EACZ,UAAU,QAAQ,OAAO,OAAO,OAClC;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,oBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAS,IAAG,aAC9D,SAAS;EACP,GAAI;EACJ,OAAO,UAA0B;GAC/B,SAAS,MAAM,UAAU,IAAI,2BAA0B,aAAY;IACjE,SAAS,UAAU,KACjB,eAAe,SAAS,OAAO,GAC/B,SAAS,OACX;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
package/dist/tsdown.cjs
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
11
3
|
const require_rolldown = require('./rolldown.cjs');
|
|
12
4
|
let _stryke_path_append = require("@stryke/path/append");
|
|
13
5
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
14
6
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
15
7
|
let defu = require("defu");
|
|
16
|
-
defu =
|
|
8
|
+
defu = require_unplugin.__toESM(defu, 1);
|
|
17
9
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
18
10
|
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
19
11
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
@@ -23,15 +15,6 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
|
|
|
23
15
|
let _stryke_path_glob_to_regex = require("@stryke/path/glob-to-regex");
|
|
24
16
|
|
|
25
17
|
//#region src/tsdown.ts
|
|
26
|
-
var tsdown_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
27
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
28
|
-
default: () => plugin,
|
|
29
|
-
getDependencyConfig: () => getDependencyConfig,
|
|
30
|
-
plugin: () => plugin,
|
|
31
|
-
resolveFormat: () => resolveFormat,
|
|
32
|
-
resolveFromFormat: () => resolveFromFormat,
|
|
33
|
-
resolveOptions: () => resolveOptions
|
|
34
|
-
});
|
|
35
18
|
/**
|
|
36
19
|
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
37
20
|
*
|
|
@@ -231,10 +214,4 @@ exports.plugin = plugin;
|
|
|
231
214
|
exports.getDependencyConfig = getDependencyConfig;
|
|
232
215
|
exports.resolveFormat = resolveFormat;
|
|
233
216
|
exports.resolveFromFormat = resolveFromFormat;
|
|
234
|
-
exports.resolveOptions = resolveOptions;
|
|
235
|
-
Object.defineProperty(exports, 'tsdown_exports', {
|
|
236
|
-
enumerable: true,
|
|
237
|
-
get: function () {
|
|
238
|
-
return tsdown_exports;
|
|
239
|
-
}
|
|
240
|
-
});
|
|
217
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/tsdown.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { UnresolvedContext } from "@powerlines/core";
|
|
4
2
|
import { GetDependencyConfigResult } from "@powerlines/core/plugin-utils";
|
|
5
3
|
import { Format } from "@storm-software/build-tools/types";
|
package/dist/tsdown.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsdown.d.mts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AAgDA;;;;iBAAgB,mBAAA,kBAAqC,iBAAA,EACnD,OAAA,EAAS,QAAA,GACR,yBAAA;AAAA,cAqBU,eAAA,EAAiB,OAAO,CAAC,YAAA;;;;;;;iBAatB,aAAA,CAAc,OAAA,GAAU,MAAA,GAAS,MAAA,KAAW,QAAA;;AAlChC;AAqB5B;;;;iBAiCgB,iBAAA,CACd,OAAA,GAAU,QAAA,GAAe,QAAA,KACxB,MAAA;AAtBH;;;;;;AAAA,iBA2DgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,YAAA;;;;;;;AA7DqE;AAoBxE;;;;;;;;;;;;;AAES;AAqCT;;iBAuLgB,MAAA,CAAO,OAAA,GAAS,YAAA,GAAkB,YAAU"}
|
package/dist/tsdown.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
1
|
import plugin$1 from "./rolldown.mjs";
|
|
11
2
|
import { appendPath } from "@stryke/path/append";
|
|
12
3
|
import { relativePath } from "@stryke/path/file-path-fns";
|
|
@@ -21,15 +12,6 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
|
21
12
|
import { globToRegex } from "@stryke/path/glob-to-regex";
|
|
22
13
|
|
|
23
14
|
//#region src/tsdown.ts
|
|
24
|
-
var tsdown_exports = /* @__PURE__ */ __exportAll({
|
|
25
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
26
|
-
default: () => plugin,
|
|
27
|
-
getDependencyConfig: () => getDependencyConfig,
|
|
28
|
-
plugin: () => plugin,
|
|
29
|
-
resolveFormat: () => resolveFormat,
|
|
30
|
-
resolveFromFormat: () => resolveFromFormat,
|
|
31
|
-
resolveOptions: () => resolveOptions
|
|
32
|
-
});
|
|
33
15
|
/**
|
|
34
16
|
* Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.
|
|
35
17
|
*
|
|
@@ -223,5 +205,5 @@ function plugin(options = {}) {
|
|
|
223
205
|
}
|
|
224
206
|
|
|
225
207
|
//#endregion
|
|
226
|
-
export { DEFAULT_OPTIONS, plugin as default, plugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions
|
|
208
|
+
export { DEFAULT_OPTIONS, plugin as default, plugin, getDependencyConfig, resolveFormat, resolveFromFormat, resolveOptions };
|
|
227
209
|
//# sourceMappingURL=tsdown.mjs.map
|
package/dist/tsdown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.mjs","names":["_getDependencyConfig","rolldown"],"sources":["../src/tsdown.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 {\n CopyConfig,\n ResolveConfig,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport type { GetDependencyConfigResult } from \"@powerlines/core/plugin-utils\";\nimport { getDependencyConfig as _getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { globToRegex } from \"@stryke/path/glob-to-regex\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { ModuleFormat } from \"rolldown\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { UnpluginExecutionOptions } from \"./types\";\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig<TContext extends UnresolvedContext>(\n context: TContext\n): GetDependencyConfigResult {\n const { external, noExternal } = _getDependencyConfig(context);\n\n return {\n external:\n !external || external.length === 0\n ? undefined\n : external.map(ext =>\n isSetString(ext) && ext.includes(\"*\") ? globToRegex(ext) : ext\n ),\n noExternal:\n !noExternal || noExternal.length === 0\n ? undefined\n : noExternal.map(noExt =>\n isSetString(noExt) && noExt.includes(\"*\")\n ? globToRegex(noExt)\n : noExt\n )\n };\n}\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = <TContext extends UnresolvedContext>(\n context: TContext,\n ...msgs: any[]\n) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .trim()\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n name: context.config.name,\n cwd: appendPath(context.config.root, context.config.cwd),\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n exports: {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n },\n define: context.config.define,\n inputOptions: {\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n }\n },\n deps: {\n neverBundle: external,\n alwaysBundle: context.config.resolve.skipNodeModulesBundle\n ? undefined\n : noExternal,\n onlyBundle: context.config.resolve.skipNodeModulesBundle\n ? noExternal\n : undefined,\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle\n },\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\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 format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n nodeProtocol: context.config.output.nodeProtocol,\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n logLevel: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n customLogger: {\n level: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * A Tsdown configuration function that integrates Powerlines into the build process.\n *\n * @see https://github.com/rolldown/tsdown\n *\n * @example\n * ```ts\n * // tsdown.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsdown\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsdown options to merge with the Powerlines configuration.\n * @returns The merged Tsdown configuration options.\n */\nexport function plugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n ...options,\n output: {\n path: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n copy: {\n path: options.outDir!,\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n if (isSetString(copy)) {\n return copy;\n }\n if (isFunction(copy)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based copy options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as CopyConfig[\"assets\"]\n }\n },\n resolve: {\n external: options.deps?.neverBundle\n ? (toArray(options.deps?.neverBundle)\n .map(external => {\n if (isFunction(external)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based external options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal:\n (options.deps?.skipNodeModulesBundle && options.deps?.onlyBundle) ||\n (!options.deps?.skipNodeModulesBundle && options.deps?.alwaysBundle)\n ? (toArray(\n options.deps?.skipNodeModulesBundle\n ? options.deps?.onlyBundle\n : options.deps?.alwaysBundle\n )\n .map(noExternal => {\n if (isFunction(noExternal)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based noExternal options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n } as UnpluginExecutionOptions)\n ]\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,oBACd,SAC2B;CAC3B,MAAM,EAAE,UAAU,eAAeA,sBAAqB,OAAO;CAE7D,OAAO;EACL,UACE,CAAC,YAAY,SAAS,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O,IACjB;GACR;GACA,UAAU,YAAY,QAAQ,QAAQ,IAAI,QAAQ,WAAW;EAC/D,CAA6B,CAC/B;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"tsdown.mjs","names":["_getDependencyConfig","rolldown"],"sources":["../src/tsdown.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 {\n CopyConfig,\n ResolveConfig,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport type { GetDependencyConfigResult } from \"@powerlines/core/plugin-utils\";\nimport { getDependencyConfig as _getDependencyConfig } from \"@powerlines/core/plugin-utils\";\nimport type { Format } from \"@storm-software/build-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { globToRegex } from \"@stryke/path/glob-to-regex\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport { ModuleFormat } from \"rolldown\";\nimport { UserConfig as BuildOptions, Format as TsdownFormat } from \"tsdown\";\nimport type { UserConfig } from \"tsdown/config\";\nimport rolldown from \"./rolldown\";\nimport { UnpluginExecutionOptions } from \"./types\";\n\n/**\n * Get the {@link ResolveConfig.external | external} and {@link ResolveConfig.noExternal | noExternal} dependencies for the build configuration.\n *\n * @param context - The build context.\n * @returns The dependency configuration.\n */\nexport function getDependencyConfig<TContext extends UnresolvedContext>(\n context: TContext\n): GetDependencyConfigResult {\n const { external, noExternal } = _getDependencyConfig(context);\n\n return {\n external:\n !external || external.length === 0\n ? undefined\n : external.map(ext =>\n isSetString(ext) && ext.includes(\"*\") ? globToRegex(ext) : ext\n ),\n noExternal:\n !noExternal || noExternal.length === 0\n ? undefined\n : noExternal.map(noExt =>\n isSetString(noExt) && noExt.includes(\"*\")\n ? globToRegex(noExt)\n : noExt\n )\n };\n}\n\nexport const DEFAULT_OPTIONS: Partial<BuildOptions> = {\n platform: \"neutral\",\n target: \"esnext\",\n fixedExtension: true,\n clean: false\n} as const;\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFormat(formats?: Format | Format[]): TsdownFormat[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n default:\n return \"esm\";\n }\n });\n}\n\n/**\n * Resolves the entry options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param formats - The formats to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveFromFormat(\n formats?: TsdownFormat | TsdownFormat[]\n): Format[] {\n return toArray(formats).map(format => {\n switch (format) {\n case \"cjs\":\n case \"commonjs\":\n return \"cjs\";\n case \"iife\":\n return \"iife\";\n case \"esm\":\n case \"es\":\n case \"module\":\n case \"umd\":\n default:\n return \"esm\";\n }\n });\n}\n\nconst formatMessage = <TContext extends UnresolvedContext>(\n context: TContext,\n ...msgs: any[]\n) =>\n msgs\n .filter(Boolean)\n .join(\" \")\n .trim()\n .replace(new RegExp(`\\\\[${context.config.name}\\\\]`, \"g\"), \"\")\n .replaceAll(/^\\s+/g, \"\")\n .replaceAll(/\\s+$/g, \"\")\n .trim();\n\n/**\n * Resolves the options for [tsdown](https://github.com/rolldown/tsdown).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): BuildOptions {\n const { external, noExternal } = getDependencyConfig(context);\n\n return defu(\n {\n name: context.config.name,\n cwd: appendPath(context.config.root, context.config.cwd),\n entry:\n context.entry.filter(entry => entry?.file).length > 0\n ? Object.fromEntries(\n context.entry\n .filter(entry => entry?.file)\n .map(entry => [\n entry.output ||\n replaceExtension(\n replacePath(\n replacePath(\n entry.file,\n joinPaths(context.config.root, \"src\")\n ),\n context.entryPath\n )\n ),\n entry.file\n ])\n )\n : [\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.ts\"\n ),\n joinPaths(\n context.config.cwd,\n context.config.root,\n \"src\",\n \"**/*.tsx\"\n )\n ],\n exports: {\n customExports: (exports: Record<string, any>) => {\n const result = Object.fromEntries(\n Object.entries(exports).map(([key, value]) => {\n if (isSetString(value)) {\n return [key, value];\n }\n\n const currentExport = {} as Record<string, any>;\n if (isSetString(value.require)) {\n currentExport.require = {\n types: replaceExtension(value.require, \".d.cts\", {\n fullExtension: true\n }),\n default: value.require\n };\n }\n\n if (isSetString(value.import)) {\n currentExport.import = {\n types: replaceExtension(value.import, \".d.mts\", {\n fullExtension: true\n }),\n default: value.import\n };\n }\n\n if (!isSetObject(value.default)) {\n if (isSetObject(currentExport.import)) {\n currentExport.default = currentExport.import;\n } else if (isSetObject(currentExport.require)) {\n currentExport.default = currentExport.require;\n }\n }\n\n return [key, currentExport];\n })\n );\n\n return Object.keys(result)\n .sort()\n .reduce(\n (ret, key) => {\n ret[key] = result[key];\n return ret;\n },\n {} as Record<string, any>\n );\n }\n },\n define: context.config.define,\n inputOptions: {\n transform: {\n define: context.config.define,\n inject: context.config.inject,\n typescript: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target\n }\n }\n },\n deps: {\n neverBundle: external,\n alwaysBundle: context.config.resolve.skipNodeModulesBundle\n ? undefined\n : noExternal,\n onlyBundle: context.config.resolve.skipNodeModulesBundle\n ? noExternal\n : undefined,\n skipNodeModulesBundle: context.config.resolve.skipNodeModulesBundle\n },\n alias: context.alias,\n resolve: {\n alias: context.alias\n },\n platform: context.config.platform,\n dts: context.config.output.dts,\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 format: resolveFormat(context.config.output.format).filter(Boolean),\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n nodeProtocol: context.config.output.nodeProtocol,\n debug: context.config.mode === \"development\",\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n logLevel: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n customLogger: {\n level: context.config.logLevel.general === \"trace\" ? \"debug\" : \"error\",\n info: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs)),\n warn: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n warnOnce: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.warn(formatMessage(context, ...msgs)),\n error: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.error(formatMessage(context, ...msgs)),\n success: (...msgs: any[]) =>\n isSetString(formatMessage(context, ...msgs).replace(/\\s+/g, \"\")) &&\n context.trace(formatMessage(context, ...msgs))\n }\n },\n DEFAULT_OPTIONS\n ) as BuildOptions;\n}\n\n/**\n * A Tsdown configuration function that integrates Powerlines into the build process.\n *\n * @see https://github.com/rolldown/tsdown\n *\n * @example\n * ```ts\n * // tsdown.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsdown\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsdown options to merge with the Powerlines configuration.\n * @returns The merged Tsdown configuration options.\n */\nexport function plugin(options: UserConfig = {}): UserConfig {\n return {\n ...options,\n entry: options.entry,\n plugins: [\n rolldown({\n ...options,\n output: {\n path: options.outDir,\n format: resolveFromFormat(\n options.format as ModuleFormat | ModuleFormat[]\n ),\n copy: {\n path: options.outDir!,\n assets: toArray(options.copy)\n .map(copy => {\n if (!copy) {\n return undefined;\n }\n if (isSetString(copy)) {\n return copy;\n }\n if (isFunction(copy)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based copy options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return {\n input: copy.from,\n output: copy.to\n };\n })\n .filter(Boolean) as CopyConfig[\"assets\"]\n }\n },\n resolve: {\n external: options.deps?.neverBundle\n ? (toArray(options.deps?.neverBundle)\n .map(external => {\n if (isFunction(external)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based external options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return external;\n })\n .filter(Boolean) as ResolveConfig[\"external\"])\n : undefined,\n noExternal:\n (options.deps?.skipNodeModulesBundle && options.deps?.onlyBundle) ||\n (!options.deps?.skipNodeModulesBundle && options.deps?.alwaysBundle)\n ? (toArray(\n options.deps?.skipNodeModulesBundle\n ? options.deps?.onlyBundle\n : options.deps?.alwaysBundle\n )\n .map(noExternal => {\n if (isFunction(noExternal)) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Function-based noExternal options are not supported in Powerlines.\"\n );\n return undefined;\n }\n return noExternal;\n })\n .filter(Boolean) as ResolveConfig[\"noExternal\"])\n : undefined\n },\n tsconfig: isSetString(options.tsconfig) ? options.tsconfig : undefined\n } as UnpluginExecutionOptions)\n ]\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,o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ACjB,IAAI,WAAW,UAAU,GAAG;MAE1B,QAAQ,KACN,oEACF;MACA;KACF;KACA,OAAO;IACT,CAAC,EACA,OAAO,OAAO,IACjB;GACR;GACA,UAAU,YAAY,QAAQ,QAAQ,IAAI,QAAQ,WAAW;EAC/D,CAA6B,CAC/B;CACF;AACF"}
|
package/dist/tsup.cjs
CHANGED
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
11
3
|
const require_esbuild = require('./esbuild.cjs');
|
|
12
4
|
let _stryke_path_append = require("@stryke/path/append");
|
|
13
5
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
14
6
|
let defu = require("defu");
|
|
15
|
-
defu =
|
|
7
|
+
defu = require_unplugin.__toESM(defu, 1);
|
|
16
8
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
17
9
|
let _storm_software_tsup_constants = require("@storm-software/tsup/constants");
|
|
18
10
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
19
11
|
|
|
20
12
|
//#region src/tsup.ts
|
|
21
|
-
var tsup_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
22
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
23
|
-
default: () => withPlugin,
|
|
24
|
-
resolveEntry: () => resolveEntry,
|
|
25
|
-
resolveOptions: () => resolveOptions,
|
|
26
|
-
withPlugin: () => withPlugin
|
|
27
|
-
});
|
|
28
13
|
const DEFAULT_OPTIONS = {
|
|
29
14
|
..._storm_software_tsup_constants.DEFAULT_BUILD_OPTIONS,
|
|
30
15
|
target: "esnext",
|
|
@@ -128,10 +113,4 @@ exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
|
|
|
128
113
|
exports.default = withPlugin;
|
|
129
114
|
exports.withPlugin = withPlugin;
|
|
130
115
|
exports.resolveEntry = resolveEntry;
|
|
131
|
-
exports.resolveOptions = resolveOptions;
|
|
132
|
-
Object.defineProperty(exports, 'tsup_exports', {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function () {
|
|
135
|
-
return tsup_exports;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
116
|
+
exports.resolveOptions = resolveOptions;
|
package/dist/tsup.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { ResolvedEntryFileReference, UnresolvedContext } from "@powerlines/core";
|
|
4
2
|
import { Entry } from "@storm-software/build-tools/types";
|
|
5
3
|
import { resolveOptions as resolveOptions$1 } from "@storm-software/tsup";
|
package/dist/tsup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.d.mts","names":[],"sources":["../src/tsup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsup.d.mts","names":[],"sources":["../src/tsup.ts"],"mappings":";;;;;;cAiCa,eAAA,EAAiB,OAAO,CAAC,SAAA;;AAAtC;;;;AAA6C;AAwB7C;iBAAgB,YAAA,kBAA8B,iBAAA,EAC5C,OAAA,EAAS,QAAA,EACT,WAAA,EAAa,0BAAA,gBACZ,KAAA;;;;;;;iBAca,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,UAAA,QAAkB,gBAAA;;;;;;;;;AAhBb;AAcR;;;;;;;;;;;;;;iBAwFgB,UAAA,CAAW,OAAA,EAAS,SAAA,GAAU,SAAO"}
|
package/dist/tsup.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
1
|
import plugin, { resolveEntry as resolveEntry$1 } from "./esbuild.mjs";
|
|
11
2
|
import { appendPath } from "@stryke/path/append";
|
|
12
3
|
import { relativePath } from "@stryke/path/file-path-fns";
|
|
@@ -16,13 +7,6 @@ import { DEFAULT_BUILD_OPTIONS } from "@storm-software/tsup/constants";
|
|
|
16
7
|
import { getUnique } from "@stryke/helpers/get-unique";
|
|
17
8
|
|
|
18
9
|
//#region src/tsup.ts
|
|
19
|
-
var tsup_exports = /* @__PURE__ */ __exportAll({
|
|
20
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
21
|
-
default: () => withPlugin,
|
|
22
|
-
resolveEntry: () => resolveEntry,
|
|
23
|
-
resolveOptions: () => resolveOptions,
|
|
24
|
-
withPlugin: () => withPlugin
|
|
25
|
-
});
|
|
26
10
|
const DEFAULT_OPTIONS = {
|
|
27
11
|
...DEFAULT_BUILD_OPTIONS,
|
|
28
12
|
target: "esnext",
|
|
@@ -122,5 +106,5 @@ function withPlugin(options) {
|
|
|
122
106
|
}
|
|
123
107
|
|
|
124
108
|
//#endregion
|
|
125
|
-
export { DEFAULT_OPTIONS, withPlugin as default, withPlugin, resolveEntry, resolveOptions
|
|
109
|
+
export { DEFAULT_OPTIONS, withPlugin as default, withPlugin, resolveEntry, resolveOptions };
|
|
126
110
|
//# sourceMappingURL=tsup.mjs.map
|
package/dist/tsup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.mjs","names":["resolveEsbuildEntry","esbuild"],"sources":["../src/tsup.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 {\n ResolvedEntryFileReference,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { resolveOptions as resolveOptionsBase } from \"@storm-software/tsup\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport type { Options } from \"tsup\";\nimport esbuild, { resolveEntry as resolveEsbuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_OPTIONS: Partial<Options> = {\n ...DEFAULT_BUILD_OPTIONS,\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry<TContext extends UnresolvedContext>(\n context: TContext,\n entryPoints: ResolvedEntryFileReference[] | string[]\n): Entry {\n return resolveEsbuildEntry(context, entryPoints) as Entry;\n}\n\ntype TsupEsbuildOptionsHandler = NonNullable<Options[\"esbuildOptions\"]>;\ntype TsupEsbuildOptionsArgs = Parameters<TsupEsbuildOptionsHandler>;\ntype TsupEsbuildOptions = TsupEsbuildOptionsArgs[0];\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Parameters<typeof resolveOptionsBase>[0] {\n const result = defu(\n {\n entry: Object.fromEntries(\n Object.entries(resolveEntry(context, context.entry)).map(\n ([key, value]) => [key, appendPath(value, context.config.root)]\n )\n ),\n esbuildOptions: (options: TsupEsbuildOptions) => {\n options.alias = {\n ...context.alias,\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n {\n name: context.config.name,\n root: context.config.root,\n projectRoot: context.config.root,\n assets: context.config.output.copy\n ? (context.config.output.copy.assets as (string | AssetGlob)[])\n : undefined,\n resolveExtensions: context.config.resolve.extensions,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel.general === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.config.cwd }\n },\n DEFAULT_OPTIONS\n );\n\n result.format = getUnique(toArray(result.format));\n return result as Parameters<typeof resolveOptionsBase>[0];\n}\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function withPlugin(options: Options): Options {\n return {\n ...options,\n esbuildPlugins: [...(options.esbuildPlugins ?? []), esbuild()]\n };\n}\n\nexport default withPlugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsup.mjs","names":["resolveEsbuildEntry","esbuild"],"sources":["../src/tsup.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 {\n ResolvedEntryFileReference,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { resolveOptions as resolveOptionsBase } from \"@storm-software/tsup\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport type { Options } from \"tsup\";\nimport esbuild, { resolveEntry as resolveEsbuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_OPTIONS: Partial<Options> = {\n ...DEFAULT_BUILD_OPTIONS,\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry<TContext extends UnresolvedContext>(\n context: TContext,\n entryPoints: ResolvedEntryFileReference[] | string[]\n): Entry {\n return resolveEsbuildEntry(context, entryPoints) as Entry;\n}\n\ntype TsupEsbuildOptionsHandler = NonNullable<Options[\"esbuildOptions\"]>;\ntype TsupEsbuildOptionsArgs = Parameters<TsupEsbuildOptionsHandler>;\ntype TsupEsbuildOptions = TsupEsbuildOptionsArgs[0];\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): Parameters<typeof resolveOptionsBase>[0] {\n const result = defu(\n {\n entry: Object.fromEntries(\n Object.entries(resolveEntry(context, context.entry)).map(\n ([key, value]) => [key, appendPath(value, context.config.root)]\n )\n ),\n esbuildOptions: (options: TsupEsbuildOptions) => {\n options.alias = {\n ...context.alias,\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.paths[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n {\n name: context.config.name,\n root: context.config.root,\n projectRoot: context.config.root,\n assets: context.config.output.copy\n ? (context.config.output.copy.assets as (string | AssetGlob)[])\n : undefined,\n resolveExtensions: context.config.resolve.extensions,\n outputPath: relativePath(\n appendPath(context.config.root, context.config.cwd),\n context.config.output.path\n ),\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n minify: context.config.output.minify,\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.output.sourceMap,\n silent:\n context.config.logLevel.general === \"silent\" ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel.general === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.config.cwd }\n },\n DEFAULT_OPTIONS\n );\n\n result.format = getUnique(toArray(result.format));\n return result as Parameters<typeof resolveOptionsBase>[0];\n}\n\n/**\n * A Tsup configuration function that integrates Powerlines into the build process.\n *\n * @see https://tsup.egoist.dev/#/config\n *\n * @example\n * ```ts\n * // tsup.config.ts\n * import withPowerlines from \"@powerlines/unplugin/tsup\";\n *\n * export default withPowerlines({\n * entry: [\"src/index.ts\"],\n * format: [\"cjs\", \"esm\"],\n * dts: true,\n * sourcemap: true,\n * clean: true,\n * });\n *\n * ```\n *\n * @param options - The Tsup options to merge with the Powerlines configuration.\n * @returns The merged Tsup configuration options.\n */\nexport function withPlugin(options: Options): Options {\n return {\n ...options,\n esbuildPlugins: [...(options.esbuildPlugins ?? []), esbuild()]\n };\n}\n\nexport default withPlugin;\n"],"mappings":";;;;;;;;;AAiCA,MAAa,kBAAoC;CAC/C,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,KAAK;CACL,OAAO;CACP,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,QAAQ,CAAC;AACX;;;;;;;;AASA,SAAgB,aACd,SACA,aACO;CACP,OAAOA,eAAoB,SAAS,WAAW;AACjD;;;;;;;AAYA,SAAgB,eACd,SAC0C;CAC1C,MAAM,SAAS,KACb;EACE,OAAO,OAAO,YACZ,OAAO,QAAQ,aAAa,SAAS,QAAQ,KAAK,CAAC,EAAE,KAClD,CAAC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AAC;CAC/D;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BuildInlineConfig, ExecutionContext, ExecutionOptions, UnpluginOptions } from "@powerlines/core";
|
|
2
|
+
import { PartialKeys } from "@stryke/types/base";
|
|
3
|
+
import { UnpluginContextMeta } from "unplugin";
|
|
4
|
+
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types.d.ts
|
|
8
|
+
type UnpluginExecutionOptionsBase = Omit<PartialKeys<ExecutionOptions, "cwd" | "configFile" | "framework" | "root" | "configIndex">, "executionId">;
|
|
9
|
+
type UnpluginExecutionOptions = Omit<BuildInlineConfig, "command"> & UnpluginExecutionOptionsBase;
|
|
10
|
+
type UnpluginFactory<TContext extends ExecutionContext> = (options: UnpluginExecutionOptions | undefined, meta: UnpluginContextMeta) => UnpluginOptions<TContext>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { __reExport as a, __exportAll as i, UnpluginExecutionOptionsBase as n, UnpluginFactory as r, UnpluginExecutionOptions as t };
|
|
13
|
+
//# sourceMappingURL=types-CEaXoKbk.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CEaXoKbk.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;KA6BY,4BAAA,GAA+B,IAAA,CACzC,WAAA,CACE,gBAAA;AAAA,KAMQ,wBAAA,GAA2B,IAAA,CAAK,iBAAA,eAC1C,4BAAA;AAAA,KAEU,eAAA,kBAAiC,gBAAA,KAC3C,OAAA,EAAS,wBAAA,cACT,IAAA,EAAM,mBAAA,KACH,eAAA,CAAgB,QAAA"}
|
package/dist/types.cjs
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
11
|
-
|
|
12
|
-
//#region src/types.ts
|
|
13
|
-
var types_exports = /* @__PURE__ */ require_runtime.__exportAll({});
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
Object.defineProperty(exports, 'types_exports', {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return types_exports;
|
|
20
|
-
}
|
|
21
|
-
});
|
package/dist/types.d.cts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PartialKeys } from "@stryke/types/base";
|
|
3
|
-
import { UnpluginContextMeta } from "unplugin";
|
|
1
|
+
import { n as UnpluginExecutionOptionsBase, r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
|
|
4
2
|
export type * from "@powerlines/core/types/unplugin";
|
|
5
|
-
|
|
6
|
-
//#region src/types.d.ts
|
|
7
|
-
type UnpluginExecutionOptionsBase = Omit<PartialKeys<ExecutionOptions, "cwd" | "configFile" | "framework" | "root" | "configIndex">, "executionId">;
|
|
8
|
-
type UnpluginExecutionOptions = Omit<BuildInlineConfig, "command"> & UnpluginExecutionOptionsBase;
|
|
9
|
-
type UnpluginFactory<TContext extends ExecutionContext> = (options: UnpluginExecutionOptions | undefined, meta: UnpluginContextMeta) => UnpluginOptions<TContext>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory };
|
|
12
|
-
//# sourceMappingURL=types.d.cts.map
|
|
3
|
+
export { UnpluginExecutionOptions, UnpluginExecutionOptionsBase, UnpluginFactory };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { UnpluginContextMeta } from "unplugin";
|
|
4
2
|
import { BuildInlineConfig, ExecutionContext, ExecutionOptions, UnpluginOptions } from "@powerlines/core";
|
|
5
3
|
import { PartialKeys } from "@stryke/types/base";
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;KA6BY,4BAAA,GAA+B,IAAA,CACzC,WAAA,CACE,gBAAA;AAAA,KAMQ,wBAAA,GAA2B,IAAA,CAAK,iBAAA,eAC1C,4BAAA;AAAA,KAEU,eAAA,kBAAiC,gBAAA,KAC3C,OAAA,EAAS,wBAAA,cACT,IAAA,EAAM,mBAAA,KACH,eAAA,CAAgB,QAAA"}
|
package/dist/types.mjs
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
10
|
-
|
|
11
|
-
//#region src/types.ts
|
|
12
|
-
var types_exports = /* @__PURE__ */ __exportAll({});
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { types_exports };
|
|
16
|
-
//# sourceMappingURL=types.mjs.map
|
|
1
|
+
export { };
|
package/dist/unloader.cjs
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
10
|
-
const
|
|
11
|
-
const require_unplugin = require('./unplugin.cjs');
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
12
3
|
let unplugin = require("unplugin");
|
|
13
4
|
|
|
14
5
|
//#region src/unloader.ts
|
|
15
|
-
var unloader_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
16
|
-
createUnloaderFactory: () => createUnloaderFactory,
|
|
17
|
-
default: () => plugin,
|
|
18
|
-
plugin: () => plugin
|
|
19
|
-
});
|
|
20
6
|
/**
|
|
21
7
|
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
22
8
|
*
|
|
@@ -62,10 +48,4 @@ const plugin = (0, unplugin.createUnloaderPlugin)(createUnloaderFactory());
|
|
|
62
48
|
//#endregion
|
|
63
49
|
exports.createUnloaderFactory = createUnloaderFactory;
|
|
64
50
|
exports.default = plugin;
|
|
65
|
-
exports.plugin = plugin;
|
|
66
|
-
Object.defineProperty(exports, 'unloader_exports', {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return unloader_exports;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
51
|
+
exports.plugin = plugin;
|
package/dist/unloader.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as UnpluginFactory, t as UnpluginExecutionOptions } from "./types-CEaXoKbk.cjs";
|
|
2
2
|
import { UnpluginFactoryDecorator, UnpluginFactoryOptions } from "./unplugin.cjs";
|
|
3
3
|
import { ExecutionContext } from "@powerlines/core";
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ import { ExecutionContext } from "@powerlines/core";
|
|
|
23
23
|
* @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.
|
|
24
24
|
* @returns A function that generates a Unloader plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Unloader build.
|
|
25
25
|
*/
|
|
26
|
-
declare function createUnloaderFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
26
|
+
declare function createUnloaderFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig<import("@powerlines/core").UserConfig, import("@powerlines/core").ExecutionOptions>, any>>;
|
|
27
27
|
/**
|
|
28
28
|
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
29
29
|
*
|