@powerlines/unplugin 0.0.75 → 0.0.77
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 -8
- package/dist/astro.d.mts +0 -2
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +0 -8
- 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 +1 -9
- 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 +0 -8
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +4 -13
- 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 +2 -10
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +0 -8
- package/dist/next.d.mts +0 -2
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +0 -8
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt-DRZ7K3-X.cjs +52 -0
- package/dist/nuxt-Dj7SOTWN.mjs +48 -0
- package/dist/nuxt-Dj7SOTWN.mjs.map +1 -0
- package/dist/nuxt.cjs +3 -50
- package/dist/nuxt.d.mts +0 -2
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +3 -51
- package/dist/rolldown.cjs +5 -14
- 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 +0 -8
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.cjs +6 -15
- 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 +0 -8
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +2 -11
- 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 +0 -8
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsdown.cjs +2 -10
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts +0 -2
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +0 -8
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +2 -10
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts +0 -2
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +0 -8
- 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 -8
- 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 +0 -8
- package/dist/unloader.cjs +1 -9
- 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 +0 -8
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin-WjPT9ECw.cjs +296 -0
- package/dist/unplugin.cjs +2 -240
- 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 +1 -9
- 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 +2 -11
- 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 +0 -8
- package/dist/webpack.mjs.map +1 -1
- package/package.json +13 -13
- package/dist/_virtual/_rolldown/runtime.cjs +0 -53
- package/dist/nuxt.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/types.d.cts.map +0 -1
package/dist/nuxt.d.mts
CHANGED
package/dist/nuxt.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":";;;;;AAmBmD;;;;;;;;AA0BvC;;;;;;;;;;;cAAN,MAAA,yBAAM,UAAA,CAAA,UAAA,EAAA,UAAA"}
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,52 +1,4 @@
|
|
|
1
|
+
import "./vite.mjs";
|
|
2
|
+
import { t as plugin } from "./nuxt-Dj7SOTWN.mjs";
|
|
1
3
|
|
|
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 plugin$1 from "./vite.mjs";
|
|
10
|
-
import plugin$2 from "./webpack.mjs";
|
|
11
|
-
import { name, version } from "./package.mjs";
|
|
12
|
-
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
13
|
-
|
|
14
|
-
//#region src/nuxt.ts
|
|
15
|
-
/**
|
|
16
|
-
* A Nuxt plugin that will invoke the Powerlines API hooks during the build process.
|
|
17
|
-
*
|
|
18
|
-
* @see https://nuxt.com/docs/guide/directory-structure/modules
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* // nuxt.config.ts
|
|
23
|
-
* import { defineNuxtConfig } from "@nuxt/kit";
|
|
24
|
-
*
|
|
25
|
-
* export default defineNuxtConfig({
|
|
26
|
-
* modules: [
|
|
27
|
-
* [
|
|
28
|
-
* "@powerlines/unplugin/nuxt",
|
|
29
|
-
* { name: "example-app", ... }
|
|
30
|
-
* ],
|
|
31
|
-
* ],
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
const plugin = defineNuxtModule({
|
|
37
|
-
meta: {
|
|
38
|
-
name,
|
|
39
|
-
version,
|
|
40
|
-
configKey: "powerlines",
|
|
41
|
-
compatibility: { builder: { vite: "^8.0.0" } }
|
|
42
|
-
},
|
|
43
|
-
defaults: {},
|
|
44
|
-
setup(options) {
|
|
45
|
-
addVitePlugin(() => plugin$1(options));
|
|
46
|
-
addWebpackPlugin(() => plugin$2(options));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { plugin as default };
|
|
52
|
-
//# sourceMappingURL=nuxt.mjs.map
|
|
4
|
+
export { plugin as default };
|
package/dist/rolldown.cjs
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
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_append = require("@stryke/path/append");
|
|
13
4
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
14
5
|
let defu = require("defu");
|
|
@@ -16,17 +7,17 @@ let unplugin = require("unplugin");
|
|
|
16
7
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
17
8
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
18
9
|
let _rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
19
|
-
_rollup_plugin_inject =
|
|
10
|
+
_rollup_plugin_inject = require_unplugin.__toESM(_rollup_plugin_inject, 1);
|
|
20
11
|
let _rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
21
|
-
_rollup_plugin_node_resolve =
|
|
12
|
+
_rollup_plugin_node_resolve = require_unplugin.__toESM(_rollup_plugin_node_resolve, 1);
|
|
22
13
|
let _rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
23
|
-
_rollup_plugin_replace =
|
|
14
|
+
_rollup_plugin_replace = require_unplugin.__toESM(_rollup_plugin_replace, 1);
|
|
24
15
|
let glob = require("glob");
|
|
25
16
|
let node_module = require("node:module");
|
|
26
17
|
let rolldown_plugin_dts = require("rolldown-plugin-dts");
|
|
27
18
|
let rolldown_experimental = require("rolldown/experimental");
|
|
28
19
|
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
29
|
-
rollup_plugin_typescript2 =
|
|
20
|
+
rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2, 1);
|
|
30
21
|
|
|
31
22
|
//#region src/rolldown.ts
|
|
32
23
|
const DEFAULT_OPTIONS = {
|
package/dist/rolldown.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 { Plugin, RolldownOptions } from "rolldown";
|
|
@@ -41,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
41
41
|
* @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.
|
|
42
42
|
* @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.
|
|
43
43
|
*/
|
|
44
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
44
|
+
declare function createRolldownFactory<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>>;
|
|
45
45
|
/**
|
|
46
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
47
47
|
*
|
package/dist/rolldown.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,
|
|
1
|
+
{"version":3,"file":"rolldown.d.cts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;;;;;;;AAAe;AA4PlB;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,MAAA,QAAA,MAAA"}
|
package/dist/rolldown.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";
|
|
@@ -43,7 +41,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
43
41
|
* @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.
|
|
44
42
|
* @returns A function that generates a Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.
|
|
45
43
|
*/
|
|
46
|
-
declare function createRolldownFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
44
|
+
declare function createRolldownFactory<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>>;
|
|
47
45
|
/**
|
|
48
46
|
* A Rolldown plugin that will invoke the Powerlines API hooks during the build process.
|
|
49
47
|
*
|
package/dist/rolldown.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rolldown.d.mts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;;;;;cA6Ca,eAAA;;;;;;;;;;;;;AAeb;iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,eAAA;;;;;;;;;;;;;AAAe;AA4PlB;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA,4BAAA,UAAA,6BAAA,gBAAA;;;;;;;;;;;;;;;;cAuC7D,MAAA,GAAM,OAAA,GAAgD,wBAAA,iBAAhD,MAAA,QAAA,MAAA"}
|
package/dist/rolldown.mjs
CHANGED
|
@@ -1,11 +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
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
10
2
|
import { builtinModules } from "node:module";
|
|
11
3
|
import { appendPath } from "@stryke/path/append";
|
package/dist/rolldown.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"sources":["../src/rolldown.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 ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ 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 Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n (await unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n )) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO,gBAAgB;GAGxC,OAAO,CAAC,QAAQ,OAAO,QAAQ;EACjC;EACA,SAAS;GACP,iBAAiB;IACf,OAAO;IACP,UAAU,QAAQ,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":"rolldown.mjs","names":["defu","alias","dtsBundlePlugin"],"sources":["../src/rolldown.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 ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"glob\";\nimport { builtinModules } from \"node:module\";\nimport type { InputOptions, Plugin } from \"rolldown\";\nimport { RolldownOptions, RollupLog } from \"rolldown\";\nimport { dts as dtsBundlePlugin } from \"rolldown-plugin-dts\";\nimport { viteAliasPlugin as alias } from \"rolldown/experimental\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRolldownPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\nexport const DEFAULT_OPTIONS = {\n keepNames: true,\n treeshake: true,\n shimMissingExports: true,\n transform: {\n target: \"esnext\"\n }\n};\n\n/**\n * Resolves the options for [rolldown](https://rolldown.rs).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RolldownOptions {\n return defu<RolldownOptions, any>(\n {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"esm\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n )\n })\n : undefined,\n context.config.output.dts &&\n toArray(context.config.output.format).includes(\"cjs\")\n ? dtsBundlePlugin({\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n emitDtsOnly: true,\n cjsDefault: true\n })\n : undefined,\n {\n name: `powerlines:node-protocol`,\n resolveId: {\n order: \"pre\",\n filter: {\n id:\n context.config.output.nodeProtocol === \"strip\"\n ? new RegExp(\n `^node:(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n : new RegExp(\n `^(${builtinModules\n .filter(mod => !mod.startsWith(\"node:\"))\n .join(\"|\")})$`\n )\n },\n handler:\n context.config.output.nodeProtocol === \"strip\"\n ? async (id: string, ...args: any[]) => {\n const resolved = await context.resolve(\n id.slice(5),\n ...args\n );\n if (resolved && !resolved.external) {\n return resolved;\n }\n\n return {\n id: id.slice(5), // \"node:\".length\n external: true,\n moduleSideEffects: false\n };\n }\n : id => {\n return {\n id: `node:${id}`,\n external: true,\n moduleSideEffects: false\n };\n }\n }\n } as Plugin\n ].filter(Boolean) as Plugin[],\n resolve: {\n alias: context.alias,\n mainFields: context.config.resolve.mainFields,\n define: context.config.define,\n extensions: context.config.resolve.extensions\n },\n transform: {\n target: context.tsconfig.tsconfigJson?.compilerOptions?.target,\n define: context.config.define,\n inject: context.config.inject\n },\n platform: context.config.platform,\n tsconfig: appendPath(\n context.tsconfig.tsconfigFilePath,\n context.config.cwd\n ),\n cache: !context.config.skipCache\n ? joinPaths(context.cachePath, \"rolldown\")\n : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"error\",\n onLog(level: \"info\" | \"debug\" | \"warn\", log: RollupLog) {\n if (\n context.config.logLevel.general !== \"trace\" &&\n level === \"warn\" &&\n log.code === \"PLUGIN_TIMINGS\"\n ) {\n return;\n }\n\n if (log.message?.trim()) {\n if (level === \"info\") {\n context.logger.debug(log.message?.trim() ?? \"\");\n } else {\n context.logger.log(level, log.message?.trim() ?? \"\");\n }\n }\n },\n output: [\n toArray(context.config.output.format).includes(\"esm\")\n ? {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"named\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined,\n toArray(context.config.output.format).includes(\"cjs\")\n ? {\n dir: context.config.output.path,\n format: \"cjs\",\n sourcemap: context.config.output.sourceMap,\n codeSplitting: true,\n exports: \"auto\",\n minify: context.config.output.minify\n ? {\n compress: {\n dropDebugger:\n context.config.mode === \"production\" ? true : undefined,\n unused:\n context.config.mode === \"production\" ? true : undefined,\n treeshake: true\n },\n mangle: true\n }\n : context.config.mode === \"production\"\n ? \"dce-only\"\n : undefined\n }\n : undefined\n ].filter(Boolean) as RolldownOptions[\"output\"]\n },\n DEFAULT_OPTIONS\n );\n}\n\n/**\n * Creates a Rolldown plugin factory that generates a plugin instance.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import { createRolldownFactory } from \"@powerlines/unplugin/rolldown\";\n *\n * const powerlinesPlugin = createRolldownFactory({ 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 Rolldown plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rolldown build.\n */\nexport function createRolldownFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rolldown\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rolldown: {\n async options(options: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n options,\n (await unplugin.context.callHook(\n \"rolldown:options\",\n { environment },\n options\n )) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rolldown plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rolldown.rs/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rolldown.config.ts\n * import powerlines from \"@powerlines/unplugin/rolldown\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nconst plugin = createRolldownPlugin(createRolldownFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB;CAC7B,WAAW;CACX,WAAW;CACX,oBAAoB;CACpB,WAAW,EACT,QAAQ,SACV;AACF;;;;;;;AAQA,SAAgB,eACd,SACiB;CACjB,OAAOA,OACL;EACE,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO,gBAAgB;GAGxC,OAAO,CAAC,QAAQ,OAAO,QAAQ;EACjC;EACA,SAAS;GACP,iBAAiB;IACf,OAAO;IACP,UAAU,QAAQ,SAAS;GAC7B,CAAC;GACD,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE,SAAS,KAC5C,QAAQ;IACN,WAAW,QAAQ,OAAO,SAAS;IACnC,mBAAmB;IACnB,GAAI,QAAQ,OAAO,UAAU,CAAC;GAChC,CAAC;GACH,QAAQ,OAAO,UACb,OAAO,KAAK,QAAQ,OAAO,MAAM,EAAE,SAAS,KAC5C,OAAO;IACL,WAAW,QAAQ,OAAO,SAAS;IACnC,GAAG,QA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,SAAS,eACtB,aACA;EACR,IACA,QACJ,QAAQ,QAAQ,OAAO,OAAO,MAAM,EAAE,SAAS,KAAK,IAChD;GACE,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,WAAW,QAAQ,OAAO,OAAO;GACjC,eAAe;GACf,SAAS;GACT,QAAQ,QAAQ,OAAO,OAAO,SAC1B;IACE,UAAU;KACR,cACE,QAAQ,OAAO,SAAS,eAAe,OAAO;KAChD,QACE,QAAQ,OAAO,SAAS,eAAe,OAAO;KAChD,WAAW;IACb;IACA,QAAQ;GACV,IACA,QAAQ,OAAO,SAAS,eACtB,aACA;EACR,IACA,MACN,EAAE,OAAO,OAAO;CAClB,GACA,eACF;AACF;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS;EACP,GAAI;EACJ,UAAU,EACR,MAAM,QAAQ,SAAuB;GACnC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOF,OACL,eAAe,WAAW,GAC1B,SACC,MAAM,SAAS,QAAQ,SACtB,oBACA,EAAE,YAAY,GACd,OACF,KAAM,CAAC,CACT;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;AAiBA,MAAM,SAAS,qBAAqB,sBAAsB,CAAC"}
|
package/dist/rollup.cjs
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
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 defu = require("defu");
|
|
13
4
|
let unplugin = require("unplugin");
|
|
14
5
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
15
6
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
16
7
|
let _rollup_plugin_inject = require("@rollup/plugin-inject");
|
|
17
|
-
_rollup_plugin_inject =
|
|
8
|
+
_rollup_plugin_inject = require_unplugin.__toESM(_rollup_plugin_inject, 1);
|
|
18
9
|
let _rollup_plugin_node_resolve = require("@rollup/plugin-node-resolve");
|
|
19
|
-
_rollup_plugin_node_resolve =
|
|
10
|
+
_rollup_plugin_node_resolve = require_unplugin.__toESM(_rollup_plugin_node_resolve, 1);
|
|
20
11
|
let _rollup_plugin_replace = require("@rollup/plugin-replace");
|
|
21
|
-
_rollup_plugin_replace =
|
|
12
|
+
_rollup_plugin_replace = require_unplugin.__toESM(_rollup_plugin_replace, 1);
|
|
22
13
|
let rollup_plugin_typescript2 = require("rollup-plugin-typescript2");
|
|
23
|
-
rollup_plugin_typescript2 =
|
|
14
|
+
rollup_plugin_typescript2 = require_unplugin.__toESM(rollup_plugin_typescript2, 1);
|
|
24
15
|
let _rollup_plugin_alias = require("@rollup/plugin-alias");
|
|
25
|
-
_rollup_plugin_alias =
|
|
16
|
+
_rollup_plugin_alias = require_unplugin.__toESM(_rollup_plugin_alias, 1);
|
|
26
17
|
let node_fs = require("node:fs");
|
|
27
18
|
|
|
28
19
|
//#region src/rollup.ts
|
package/dist/rollup.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 { Plugin, RollupOptions } from "rollup";
|
|
@@ -40,7 +40,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
40
40
|
* @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.
|
|
41
41
|
* @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.
|
|
42
42
|
*/
|
|
43
|
-
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
43
|
+
declare function createRollupFactory<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>>;
|
|
44
44
|
/**
|
|
45
45
|
* A Rollup plugin that will invoke the Powerlines API hooks during the build process.
|
|
46
46
|
*
|
package/dist/rollup.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,
|
|
1
|
+
{"version":3,"file":"rollup.d.cts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;AAAa;AAuHhB;;;;;;;;;;;;;;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;;;;;;;;;;;;AAAA;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
|
package/dist/rollup.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";
|
|
@@ -42,7 +40,7 @@ declare function resolveOptions<TContext extends UnresolvedContext>(context: TCo
|
|
|
42
40
|
* @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.
|
|
43
41
|
* @returns A function that generates a Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.
|
|
44
42
|
*/
|
|
45
|
-
declare function createRollupFactory<TContext extends ExecutionContext>(options?: Omit<UnpluginFactoryOptions, "variant">, decorate?: UnpluginFactoryDecorator<TContext>): UnpluginFactory<ExecutionContext<import("@powerlines/core").ResolvedConfig, any>>;
|
|
43
|
+
declare function createRollupFactory<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>>;
|
|
46
44
|
/**
|
|
47
45
|
* A Rollup plugin that will invoke the Powerlines API hooks during the build process.
|
|
48
46
|
*
|
package/dist/rollup.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;;;;;;AA+CA;;;;cAAa,eAAA,EAAiB,MA+B7B;AAQD;;;;;;AAAA,iBAAgB,cAAA,kBAAgC,iBAAA,EAC9C,OAAA,EAAS,QAAA,GACR,aAAA;;;;;;;;AAAa;AAuHhB;;;;;;;;;;;;;;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;;;;;;;;;;;;AAAA;AAwCnE;;;;cAAa,MAAA,GAAM,OAAA,GAA4C,wBAAA,iBAA5C,MAAA,QAAA,MAAA"}
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,11 +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
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
10
2
|
import { defu as defu$1 } from "defu";
|
|
11
3
|
import { createRollupPlugin } from "unplugin";
|
package/dist/rollup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.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 ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ 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 Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;EAClC,KAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,MAAM,GAAG;GAC7C,IACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,MAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,OACF;GAEA,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,EAAE,GACxD;GAEA,KAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,SAAS,IACnC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;GAC7C,CAAC;EACH;CACF;AACF;;;;;;;AAQA,SAAgB,eACd,SACe;CACf,OAAO;EACL,OAAO,SACL,QAAQ,QAAQ,KAAK,EAAE,KAAI,UACzB,SAAS,KAAK,IAAI,QAAQ,MAAM,IAClC,CACF,EAAE,KAAK;EACP,WAAW,WAAmB;GAC5B,IACE,QAAQ,OAAO,QAAQ,YACvB,QAAQ,QAAQ,OAAO,QAAQ,QAAQ,EAAE,SAAS,MAAM,GAExD,OAAO;GAGT,IACE,QAAQ,OAAO,QAAQ,cACvB,QAAQ,QAAQ,OAAO,QAAQ,UAAU,EAAE,SAAS,MAAM,GAE1D,OAAO;GAGT,IAAI,QAAQ,SAAS,SAAS,MAAM,GAClC,OAAO,QAAQ,OAAO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AgB,oBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAS,IAAG,aAC9D,SAAS;EACP,GAAI;EACJ,QAAQ,EACN,MAAM,QAAQ,MAAoB;GAChC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOA,OACL,eAAe,WAAW,GAC1B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,YAAY,GACd,IACF,KAAK,CAAC,CACR;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"rollup.mjs","names":["defu"],"sources":["../src/rollup.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 ExecutionContext,\n UnpluginOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport alias from \"@rollup/plugin-alias\";\nimport inject from \"@rollup/plugin-inject\";\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport replace from \"@rollup/plugin-replace\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { defu } from \"defu\";\nimport { globSync } from \"node:fs\";\nimport type { InputOptions, RollupOptions } from \"rollup\";\nimport { Plugin } from \"rollup\";\nimport typescriptPlugin from \"rollup-plugin-typescript2\";\nimport { createRollupPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * A Rollup plugin to bundle TypeScript declaration files (.d.ts) alongside the JavaScript output files.\n *\n * @remarks\n * This plugin generates .d.ts files for each entry point in the bundle, ensuring that type definitions are available for consumers of the library.\n */\nexport const dtsBundlePlugin: Plugin = {\n name: \"powerlines:dts-bundle\",\n async generateBundle(_opts, bundle) {\n for (const [, file] of Object.entries(bundle)) {\n if (\n file.type === \"asset\" ||\n !file.isEntry ||\n file.facadeModuleId == null\n ) {\n continue;\n }\n\n // Replace various JavaScript file extensions (e.g., .js, .cjs, .mjs, .cjs.js, .mjs.js) with .d.ts for generating type definition file names.\n const dtsFileName = file.fileName.replace(\n /(?:\\.cjs|\\.mjs|\\.esm\\.js|\\.cjs\\.js|\\.mjs\\.js|\\.js)$/,\n \".d.ts\"\n );\n\n const relativeSourceDtsName = JSON.stringify(\n `./${file.facadeModuleId.replace(/\\.[cm]?[jt]sx?$/, \"\")}`\n );\n\n this.emitFile({\n type: \"asset\",\n fileName: dtsFileName,\n source: file.exports.includes(\"default\")\n ? `export * from ${relativeSourceDtsName};\\nexport { default } from ${relativeSourceDtsName};\\n`\n : `export * from ${relativeSourceDtsName};\\n`\n });\n }\n }\n};\n\n/**\n * Resolves the options for [rollup](https://rollupjs.org).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions<TContext extends UnresolvedContext>(\n context: TContext\n): RollupOptions {\n return {\n input: globSync(\n toArray(context.entry).map(entry =>\n isString(entry) ? entry : entry.file\n )\n ).flat(),\n external: (source: string) => {\n if (\n context.config.resolve.external &&\n toArray(context.config.resolve.external).includes(source)\n ) {\n return true;\n }\n\n if (\n context.config.resolve.noExternal &&\n toArray(context.config.resolve.noExternal).includes(source)\n ) {\n return false;\n }\n\n if (context.builtins.includes(source)) {\n return context.config.projectType !== \"application\";\n }\n\n return !context.config.resolve.skipNodeModulesBundle;\n },\n plugins: [\n typescriptPlugin({\n check: false,\n tsconfig: context.tsconfig.tsconfigFilePath\n }),\n context.config.define &&\n Object.keys(context.config.define).length > 0 &&\n replace({\n sourceMap: context.config.mode === \"development\",\n preventAssignment: true,\n ...(context.config.define ?? {})\n }),\n context.config.inject &&\n Object.keys(context.config.inject).length > 0 &&\n inject({\n sourceMap: context.config.mode === \"development\",\n ...context.config.inject\n }),\n alias({\n entries: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n )\n }),\n resolve({\n moduleDirectories: [\"node_modules\"],\n preferBuiltins: true\n }),\n dtsBundlePlugin\n ].filter(Boolean) as Plugin[],\n cache: !context.config.skipCache ? undefined : false,\n logLevel:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general === \"debug\"\n ? \"warn\"\n : \"silent\",\n output: [\n {\n dir: context.config.output.path,\n format: \"es\",\n entryFileNames: \"[name].js\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n },\n {\n dir: context.config.output.path,\n format: \"cjs\",\n entryFileNames: \"[name].cjs\",\n preserveModules: true,\n sourcemap: context.config.output.sourceMap\n }\n ]\n };\n}\n\n/**\n * Creates a Rollup plugin factory that generates a plugin instance.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n * import { createRollupFactory } from \"@powerlines/unplugin/rollup\";\n *\n * const powerlinesPlugin = createRollupFactory({ 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 Rollup plugin instance when called. The generated plugin will invoke the Powerlines API hooks during the build process, allowing you to integrate Powerlines into your Rollup build.\n */\nexport function createRollupFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"rollup\" }, unplugin =>\n decorate({\n ...(unplugin as UnpluginOptions<TContext>),\n rollup: {\n async options(opts: InputOptions) {\n const environment = await unplugin.context.getEnvironment();\n\n return defu(\n resolveOptions(environment),\n opts,\n unplugin.context.callHook(\n \"rollup:options\",\n { environment },\n opts\n ) ?? {}\n );\n }\n }\n })\n );\n}\n\n/**\n * A Rollup plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://rollupjs.org/guide/en/#plugins-overview\n *\n * @example\n * ```ts\n * // rollup.config.ts\n *\n * import powerlines from \"@powerlines/unplugin/rollup\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * })\n * ```\n */\nexport const plugin = createRollupPlugin(createRollupFactory());\n\nexport { plugin as default };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,MAAa,kBAA0B;CACrC,MAAM;CACN,MAAM,eAAe,OAAO,QAAQ;EAClC,KAAK,MAAM,GAAG,SAAS,OAAO,QAAQ,MAAM,GAAG;GAC7C,IACE,KAAK,SAAS,WACd,CAAC,KAAK,WACN,KAAK,kBAAkB,MAEvB;GAIF,MAAM,cAAc,KAAK,SAAS,QAChC,uDACA,OACF;GAEA,MAAM,wBAAwB,KAAK,UACjC,KAAK,KAAK,eAAe,QAAQ,mBAAmB,EAAE,GACxD;GAEA,KAAK,SAAS;IACZ,MAAM;IACN,UAAU;IACV,QAAQ,KAAK,QAAQ,SAAS,SAAS,IACnC,iBAAiB,sBAAsB,6BAA6B,sBAAsB,OAC1F,iBAAiB,sBAAsB;GAC7C,CAAC;EACH;CACF;AACF;;;;;;;AAQA,SAAgB,eACd,SACe;CACf,OAAO;EACL,OAAO,SACL,QAAQ,Q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,UACE,QAAQ,OAAO,SAAS,YAAY,UAChC,UACA,QAAQ,OAAO,SAAS,YAAY,UAClC,SACA;EACR,QAAQ,CACN;GACE,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,gBAAgB;GAChB,iBAAiB;GACjB,WAAW,QAAQ,OAAO,OAAO;EACnC,GACA;GACE,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,gBAAgB;GAChB,iBAAiB;GACjB,WAAW,QAAQ,OAAO,OAAO;EACnC,CACF;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,QAAQ,EACN,MAAM,QAAQ,MAAoB;GAChC,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe;GAE1D,OAAOA,OACL,eAAe,WAAW,GAC1B,MACA,SAAS,QAAQ,SACf,kBACA,EAAE,YAAY,GACd,IACF,KAAK,CAAC,CACR;EACF,EACF;CACF,CAAC,CACH;AACF;;;;;;;;;;;;;;;;;AAkBA,MAAa,SAAS,mBAAmB,oBAAoB,CAAC"}
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,17 +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 _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
|
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,
|
|
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,11 +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
1
|
import { createUnpluginFactory } from "./unplugin.mjs";
|
|
10
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
11
3
|
import defu from "defu";
|
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");
|
package/dist/tsdown.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.d.cts","names":[],"sources":["../src/tsdown.ts"],"mappings":";;;;;;;;;AAgDA;;;;iBAAgB,mBAAA,kBAAqC,iBAAA,
|
|
1
|
+
{"version":3,"file":"tsdown.d.cts","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.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,11 +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
1
|
import plugin$1 from "./rolldown.mjs";
|
|
10
2
|
import { appendPath } from "@stryke/path/append";
|
|
11
3
|
import { relativePath } from "@stryke/path/file-path-fns";
|