@powerlines/unplugin 0.0.76 → 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 -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-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 -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 +3 -67
- 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/unloader.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.d.cts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;iBAAgB,qBAAA,kBAAuC,gBAAA,EACrD,OAAA,GAAS,IAAA,CAAK,sBAAA,cACd,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAA8B,eAAA,CAAA,gBAAA,4BAAA,cAAA
|
|
1
|
+
{"version":3,"file":"unloader.d.cts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;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;;;;;;;;;AAAA;AAqBnE;;;;;cAAa,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,sBAAA,MAAA"}
|
package/dist/unloader.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 } from "@powerlines/core";
|
|
@@ -25,7 +23,7 @@ import { ExecutionContext } from "@powerlines/core";
|
|
|
25
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.
|
|
26
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.
|
|
27
25
|
*/
|
|
28
|
-
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>>;
|
|
29
27
|
/**
|
|
30
28
|
* An Unloader plugin that will invoke the Powerlines API hooks during processing.
|
|
31
29
|
*
|
package/dist/unloader.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unloader.d.mts","names":[],"sources":["../src/unloader.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;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;;;;;;;;;AAAA;AAqBnE;;;;;cAAa,MAAA,GAAM,OAAA,GAAgD,wBAAhD,oCAAA,MAAA,sBAAA,MAAA"}
|
package/dist/unloader.mjs
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
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 { createUnloaderPlugin } from "unplugin";
|
|
12
3
|
|
|
13
4
|
//#region src/unloader.ts
|
|
14
|
-
var unloader_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
-
createUnloaderFactory: () => createUnloaderFactory,
|
|
16
|
-
default: () => plugin,
|
|
17
|
-
plugin: () => plugin
|
|
18
|
-
});
|
|
19
5
|
/**
|
|
20
6
|
* Creates a Unloader plugin factory that generates a plugin instance.
|
|
21
7
|
*
|
|
@@ -59,5 +45,5 @@ function createUnloaderFactory(options = {}, decorate = (options) => options) {
|
|
|
59
45
|
const plugin = createUnloaderPlugin(createUnloaderFactory());
|
|
60
46
|
|
|
61
47
|
//#endregion
|
|
62
|
-
export { createUnloaderFactory, plugin as default, plugin
|
|
48
|
+
export { createUnloaderFactory, plugin as default, plugin };
|
|
63
49
|
//# sourceMappingURL=unloader.mjs.map
|
package/dist/unloader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 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.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unloader.mjs","names":[],"sources":["../src/unloader.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 { ExecutionContext, UnpluginOptions } from \"@powerlines/core\";\nimport { createUnloaderPlugin } from \"unplugin\";\nimport {\n createUnpluginFactory,\n UnpluginFactoryDecorator,\n UnpluginFactoryOptions\n} from \"./unplugin\";\n\n/**\n * Creates a Unloader plugin factory that generates a plugin instance.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import { createUnloaderFactory } from \"@powerlines/unplugin/unloader\";\n *\n * const powerlinesPlugin = createUnloaderFactory({ 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 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.\n */\nexport function createUnloaderFactory<TContext extends ExecutionContext>(\n options: Omit<UnpluginFactoryOptions, \"variant\"> = {},\n decorate: UnpluginFactoryDecorator<TContext> = options => options\n) {\n return createUnpluginFactory({ ...options, variant: \"unloader\" }, unplugin =>\n decorate(unplugin as UnpluginOptions<TContext>)\n );\n}\n\n/**\n * An Unloader plugin that will invoke the Powerlines API hooks during processing.\n *\n * @example\n * ```js\n * // unloader.config.js\n * import powerlines from \"@powerlines/unplugin/unloader\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const plugin = createUnloaderPlugin(createUnloaderFactory());\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,sBACd,UAAmD,CAAC,GACpD,YAA+C,YAAW,SAC1D;CACA,OAAO,sBAAsB;EAAE,GAAG;EAAS,SAAS;CAAW,IAAG,aAChE,SAAS,QAAqC,CAChD;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,qBAAqB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) {
|
|
11
|
+
__defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (!no_symbols) {
|
|
17
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
+
value: mod,
|
|
38
|
+
enumerable: true
|
|
39
|
+
}) : target, mod));
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
43
|
+
let _powerlines_core = require("@powerlines/core");
|
|
44
|
+
let _powerlines_core_constants = require("@powerlines/core/constants");
|
|
45
|
+
let _powerlines_core_context_execution_context = require("@powerlines/core/context/execution-context");
|
|
46
|
+
let _powerlines_core_lib_context_helpers = require("@powerlines/core/lib/context-helpers");
|
|
47
|
+
let _powerlines_core_lib_environment = require("@powerlines/core/lib/environment");
|
|
48
|
+
let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
|
|
49
|
+
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
50
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
51
|
+
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
52
|
+
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
53
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
54
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
55
|
+
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
56
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
57
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
58
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
59
|
+
|
|
60
|
+
//#region src/unplugin.ts
|
|
61
|
+
/**
|
|
62
|
+
* Creates a Powerlines unplugin factory that generates a plugin instance.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { createUnpluginFactory } from "@powerlines/unplugin";
|
|
70
|
+
*
|
|
71
|
+
* const factory = createUnpluginFactory({
|
|
72
|
+
* variant: "vite",
|
|
73
|
+
* framework: "my-framework",
|
|
74
|
+
* orgId: "my-org",
|
|
75
|
+
* customLogger: myCustomLogger
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* const plugin = createVitePlugin(factory);
|
|
79
|
+
* export default plugin;
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @param options - The options for the unplugin factory, including the build variant and an optional custom logger.
|
|
83
|
+
* @param decorate - An optional function to decorate the unplugin options.
|
|
84
|
+
* @returns The unplugin factory that generates a plugin instance.
|
|
85
|
+
*/
|
|
86
|
+
function createUnpluginFactory(options, decorate = (options) => options) {
|
|
87
|
+
if (!(0, _powerlines_core.isUnpluginBuilderVariant)(options.variant)) throw new Error(`Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${_powerlines_core_constants.UNPLUGIN_BUILDER_VARIANTS.join(", ")}.`);
|
|
88
|
+
const cwd = (0, _stryke_fs_get_workspace_root.getWorkspaceRoot)(process.cwd());
|
|
89
|
+
const virtualModulePrefix = options.virtualModulePrefix ?? "\\0";
|
|
90
|
+
return (params = {}) => {
|
|
91
|
+
let context;
|
|
92
|
+
try {
|
|
93
|
+
const framework = (params.framework?.name ?? options.framework?.name) || "powerlines";
|
|
94
|
+
const orgId = (params.framework?.orgId ?? options.framework?.orgId) || "storm-software";
|
|
95
|
+
const root = (0, _powerlines_core.resolveRoot)(cwd, params.root, params.configFile);
|
|
96
|
+
async function buildStart() {
|
|
97
|
+
const config = await (0, _powerlines_core.loadParsedConfig)(cwd, root, framework, orgId, {
|
|
98
|
+
...params,
|
|
99
|
+
command: "build"
|
|
100
|
+
});
|
|
101
|
+
if (!config) throw new Error("Failed to load configuration");
|
|
102
|
+
const configs = (0, _stryke_convert_to_array.toArray)(config.config);
|
|
103
|
+
if (params.configIndex !== void 0 && params.configIndex >= configs.length) throw new Error(`Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`);
|
|
104
|
+
const _options = {
|
|
105
|
+
cwd,
|
|
106
|
+
root,
|
|
107
|
+
...params,
|
|
108
|
+
command: "build",
|
|
109
|
+
configFile: config.configFile,
|
|
110
|
+
executionId: (0, _powerlines_core_plugin_utils.formatExecutionId)(config.config.name || root, "build", 0),
|
|
111
|
+
configIndex: 0
|
|
112
|
+
};
|
|
113
|
+
context = await _powerlines_core_context_execution_context.PowerlinesExecutionContext.from({
|
|
114
|
+
...options,
|
|
115
|
+
..._options,
|
|
116
|
+
configFile: config.configFile
|
|
117
|
+
}, _options);
|
|
118
|
+
context.logger.info(`Starting ${(0, _stryke_string_format_title_case.titleCase)(framework)} ${(0, _stryke_string_format_title_case.titleCase)(options.variant)} plugin execution`);
|
|
119
|
+
context.logger.debug({
|
|
120
|
+
meta: { category: "config" },
|
|
121
|
+
message: `Invoking ${(0, _stryke_string_format_title_case.titleCase)(framework)} ${(0, _stryke_string_format_title_case.titleCase)(options.variant)} plugin with the following execution parameters: \n --- Execution Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(params)}`
|
|
122
|
+
});
|
|
123
|
+
await (0, _powerlines_core_lib_context_helpers.resolvePluginConfig)(context);
|
|
124
|
+
const timer = context.timer("Preparation");
|
|
125
|
+
await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
|
|
126
|
+
env.debug(`Initializing the processing options for the Powerlines project.`);
|
|
127
|
+
await context.callHook("configResolved", {
|
|
128
|
+
environment: env,
|
|
129
|
+
order: "pre"
|
|
130
|
+
});
|
|
131
|
+
await (0, _powerlines_core.initializeTsconfig)(env);
|
|
132
|
+
await context.callHook("configResolved", {
|
|
133
|
+
environment: env,
|
|
134
|
+
order: "normal"
|
|
135
|
+
});
|
|
136
|
+
if (env.entry.length > 0) {
|
|
137
|
+
const entriesLength = (0, _stryke_type_checks_is_object.isObject)(env.config.input) ? Object.keys(env.config.input).length : (0, _stryke_convert_to_array.toArray)(env.config.input).length;
|
|
138
|
+
env.debug(`The configuration provided ${entriesLength} entry point${entriesLength !== 1 ? "s" : ""}, Powerlines has found ${env.entry.length} entry file${env.entry.length !== 1 ? "s" : ""} for the ${env.config.title} project${env.entry.length > 0 && env.entry.length < 10 ? `: \n${env.entry.map((entry) => `- ${(0, _stryke_path_replace.replacePath)(entry.file, context.config.root)}${entry.output ? ` -> ${(0, _stryke_path_replace.replacePath)(entry.output, context.config.root)}` : ""}`).join(" \n")}` : ""}`);
|
|
139
|
+
} else env.warn(`No entry files were found for the ${env.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
|
|
140
|
+
await (0, _powerlines_core.resolveTsconfig)(env);
|
|
141
|
+
await (0, _powerlines_core.installDependencies)(env);
|
|
142
|
+
await context.callHook("configResolved", {
|
|
143
|
+
environment: env,
|
|
144
|
+
order: "post"
|
|
145
|
+
});
|
|
146
|
+
env.trace({
|
|
147
|
+
meta: { category: "config" },
|
|
148
|
+
message: `Powerlines configuration after configResolved hook: \n${(0, _powerlines_core_plugin_utils.formatConfig)(env.config)}`
|
|
149
|
+
});
|
|
150
|
+
if (!env.fs.existsSync(env.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(env.cachePath);
|
|
151
|
+
if (!env.fs.existsSync(env.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(env.dataPath);
|
|
152
|
+
await context.callHook("prepare", {
|
|
153
|
+
environment: env,
|
|
154
|
+
order: "pre"
|
|
155
|
+
});
|
|
156
|
+
await context.callHook("prepare", {
|
|
157
|
+
environment: env,
|
|
158
|
+
order: "normal"
|
|
159
|
+
});
|
|
160
|
+
await context.callHook("prepare", {
|
|
161
|
+
environment: env,
|
|
162
|
+
order: "post"
|
|
163
|
+
});
|
|
164
|
+
if (env.config.output.types !== false) await (0, _powerlines_core.handleTypes)(context, env);
|
|
165
|
+
context.debug("Formatting files generated during the prepare step.");
|
|
166
|
+
await Promise.all([(0, _powerlines_core.formatFolder)(env, env.builtinsPath), (0, _powerlines_core.formatFolder)(env, env.entryPath)]);
|
|
167
|
+
await (0, _powerlines_core.writeMetaFile)(env);
|
|
168
|
+
env.persistedMeta = env.meta;
|
|
169
|
+
});
|
|
170
|
+
timer();
|
|
171
|
+
}
|
|
172
|
+
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
173
|
+
const normalizedId = (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(id);
|
|
174
|
+
const normalizedImporter = importer ? (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(importer) : void 0;
|
|
175
|
+
let result = await context.callHook("resolveId", {
|
|
176
|
+
sequential: true,
|
|
177
|
+
result: "first",
|
|
178
|
+
order: "pre"
|
|
179
|
+
}, normalizedId, normalizedImporter, opts);
|
|
180
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
181
|
+
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
182
|
+
...result,
|
|
183
|
+
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
184
|
+
};
|
|
185
|
+
result = await context.callHook("resolveId", {
|
|
186
|
+
sequential: true,
|
|
187
|
+
result: "first",
|
|
188
|
+
order: "normal"
|
|
189
|
+
}, normalizedId, normalizedImporter, opts);
|
|
190
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
191
|
+
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
192
|
+
...result,
|
|
193
|
+
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
194
|
+
};
|
|
195
|
+
result = await context.resolve(normalizedId, normalizedImporter, {
|
|
196
|
+
isFile: true,
|
|
197
|
+
...opts
|
|
198
|
+
});
|
|
199
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
200
|
+
...result,
|
|
201
|
+
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
202
|
+
};
|
|
203
|
+
result = await context.callHook("resolveId", {
|
|
204
|
+
sequential: true,
|
|
205
|
+
result: "first",
|
|
206
|
+
order: "post"
|
|
207
|
+
}, normalizedId, normalizedImporter, opts);
|
|
208
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
209
|
+
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
210
|
+
...result,
|
|
211
|
+
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
212
|
+
};
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const load = {
|
|
216
|
+
filter: virtualModulePrefix !== false ? { id: _powerlines_core_plugin_utils.VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
217
|
+
async handler(id) {
|
|
218
|
+
const normalizedId = (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(id);
|
|
219
|
+
let result = await context.callHook("load", {
|
|
220
|
+
sequential: true,
|
|
221
|
+
result: "first",
|
|
222
|
+
order: "pre"
|
|
223
|
+
}, normalizedId);
|
|
224
|
+
if (result) return result;
|
|
225
|
+
result = await context.callHook("load", {
|
|
226
|
+
sequential: true,
|
|
227
|
+
result: "first",
|
|
228
|
+
order: "normal"
|
|
229
|
+
}, normalizedId);
|
|
230
|
+
if (result) return result;
|
|
231
|
+
result = await context.load(normalizedId);
|
|
232
|
+
if (result) return result;
|
|
233
|
+
return context.callHook("load", {
|
|
234
|
+
sequential: true,
|
|
235
|
+
result: "first",
|
|
236
|
+
order: "post"
|
|
237
|
+
}, normalizedId);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
async function transform(code, id) {
|
|
241
|
+
return context.callHook("transform", {
|
|
242
|
+
environment: await context.getEnvironment(),
|
|
243
|
+
result: "merge",
|
|
244
|
+
asNextParam: (previousResult) => (0, _powerlines_core_lib_utilities_source_file.getString)(previousResult)
|
|
245
|
+
}, (0, _powerlines_core_lib_utilities_source_file.getString)(code), id);
|
|
246
|
+
}
|
|
247
|
+
async function writeBundle() {
|
|
248
|
+
context.logger.debug("Finalizing Powerlines project output...");
|
|
249
|
+
await context.callHook("writeBundle", { environment: await context.getEnvironment() });
|
|
250
|
+
}
|
|
251
|
+
context.logger.debug("Unplugin initialized successfully.");
|
|
252
|
+
const result = {
|
|
253
|
+
name: `${(0, _stryke_string_format_kebab_case.kebabCase)(framework)}:${(0, _stryke_string_format_kebab_case.kebabCase)(options.variant)}-plugin`,
|
|
254
|
+
context,
|
|
255
|
+
resolveId,
|
|
256
|
+
load,
|
|
257
|
+
transform,
|
|
258
|
+
buildStart,
|
|
259
|
+
writeBundle
|
|
260
|
+
};
|
|
261
|
+
return {
|
|
262
|
+
...result,
|
|
263
|
+
...decorate(result)
|
|
264
|
+
};
|
|
265
|
+
} catch (error) {
|
|
266
|
+
if ((0, _stryke_type_checks_is_function.isFunction)(context?.logger?.error)) context.logger.error(error?.message);
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
//#endregion
|
|
273
|
+
Object.defineProperty(exports, '__exportAll', {
|
|
274
|
+
enumerable: true,
|
|
275
|
+
get: function () {
|
|
276
|
+
return __exportAll;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
Object.defineProperty(exports, '__reExport', {
|
|
280
|
+
enumerable: true,
|
|
281
|
+
get: function () {
|
|
282
|
+
return __reExport;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
Object.defineProperty(exports, '__toESM', {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function () {
|
|
288
|
+
return __toESM;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
Object.defineProperty(exports, 'createUnpluginFactory', {
|
|
292
|
+
enumerable: true,
|
|
293
|
+
get: function () {
|
|
294
|
+
return createUnpluginFactory;
|
|
295
|
+
}
|
|
296
|
+
});
|
package/dist/unplugin.cjs
CHANGED
|
@@ -1,253 +1,7 @@
|
|
|
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.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
|
-
const
|
|
11
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
12
|
-
let _powerlines_core = require("@powerlines/core");
|
|
13
|
-
let _powerlines_core_constants = require("@powerlines/core/constants");
|
|
14
|
-
let _powerlines_core_context_execution_context = require("@powerlines/core/context/execution-context");
|
|
15
|
-
let _powerlines_core_lib_context_helpers = require("@powerlines/core/lib/context-helpers");
|
|
16
|
-
let _powerlines_core_lib_environment = require("@powerlines/core/lib/environment");
|
|
17
|
-
let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
|
|
18
|
-
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
19
|
-
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
20
|
-
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
21
|
-
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
22
|
-
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
23
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
24
|
-
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
25
|
-
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
26
|
-
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
27
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
28
|
-
|
|
29
|
-
//#region src/unplugin.ts
|
|
30
|
-
var unplugin_exports = /* @__PURE__ */ require_runtime.__exportAll({ createUnpluginFactory: () => createUnpluginFactory });
|
|
31
|
-
require_runtime.__reExport(unplugin_exports, require("@powerlines/core/lib/unplugin"));
|
|
32
|
-
/**
|
|
33
|
-
* Creates a Powerlines unplugin factory that generates a plugin instance.
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* The factory will handle loading the Powerlines configuration, resolving the plugin configuration, and executing the appropriate hooks during the build process. It also allows for optional customization of logging and framework identification through the provided options.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* import { createUnpluginFactory } from "@powerlines/unplugin";
|
|
41
|
-
*
|
|
42
|
-
* const factory = createUnpluginFactory({
|
|
43
|
-
* variant: "vite",
|
|
44
|
-
* framework: "my-framework",
|
|
45
|
-
* orgId: "my-org",
|
|
46
|
-
* customLogger: myCustomLogger
|
|
47
|
-
* });
|
|
48
|
-
*
|
|
49
|
-
* const plugin = createVitePlugin(factory);
|
|
50
|
-
* export default plugin;
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @param options - The options for the unplugin factory, including the build variant and an optional custom logger.
|
|
54
|
-
* @param decorate - An optional function to decorate the unplugin options.
|
|
55
|
-
* @returns The unplugin factory that generates a plugin instance.
|
|
56
|
-
*/
|
|
57
|
-
function createUnpluginFactory(options, decorate = (options) => options) {
|
|
58
|
-
if (!(0, _powerlines_core.isUnpluginBuilderVariant)(options.variant)) throw new Error(`Invalid unplugin builder variant: ${String(options.variant)}. Expected one of: ${_powerlines_core_constants.UNPLUGIN_BUILDER_VARIANTS.join(", ")}.`);
|
|
59
|
-
const cwd = (0, _stryke_fs_get_workspace_root.getWorkspaceRoot)(process.cwd());
|
|
60
|
-
const virtualModulePrefix = options.virtualModulePrefix ?? "\\0";
|
|
61
|
-
return (params = {}) => {
|
|
62
|
-
let context;
|
|
63
|
-
try {
|
|
64
|
-
const framework = (params.framework?.name ?? options.framework?.name) || "powerlines";
|
|
65
|
-
const orgId = (params.framework?.orgId ?? options.framework?.orgId) || "storm-software";
|
|
66
|
-
const root = (0, _powerlines_core.resolveRoot)(cwd, params.root, params.configFile);
|
|
67
|
-
async function buildStart() {
|
|
68
|
-
const config = await (0, _powerlines_core.loadParsedConfig)(cwd, root, framework, orgId, {
|
|
69
|
-
...params,
|
|
70
|
-
command: "build"
|
|
71
|
-
});
|
|
72
|
-
if (!config) throw new Error("Failed to load configuration");
|
|
73
|
-
const configs = (0, _stryke_convert_to_array.toArray)(config.config);
|
|
74
|
-
if (params.configIndex !== void 0 && params.configIndex >= configs.length) throw new Error(`Invalid execution index: ${params.configIndex}. The configuration file contains ${configs.length} execution(s).`);
|
|
75
|
-
const _options = {
|
|
76
|
-
cwd,
|
|
77
|
-
root,
|
|
78
|
-
...params,
|
|
79
|
-
command: "build",
|
|
80
|
-
configFile: config.configFile,
|
|
81
|
-
executionId: (0, _powerlines_core_plugin_utils.formatExecutionId)(config.config.name || root, "build", 0),
|
|
82
|
-
configIndex: 0
|
|
83
|
-
};
|
|
84
|
-
context = await _powerlines_core_context_execution_context.PowerlinesExecutionContext.from({
|
|
85
|
-
...options,
|
|
86
|
-
..._options,
|
|
87
|
-
configFile: config.configFile
|
|
88
|
-
}, _options);
|
|
89
|
-
context.logger.info(`Starting ${(0, _stryke_string_format_title_case.titleCase)(framework)} ${(0, _stryke_string_format_title_case.titleCase)(options.variant)} plugin execution`);
|
|
90
|
-
context.logger.debug({
|
|
91
|
-
meta: { category: "config" },
|
|
92
|
-
message: `Invoking ${(0, _stryke_string_format_title_case.titleCase)(framework)} ${(0, _stryke_string_format_title_case.titleCase)(options.variant)} plugin with the following execution parameters: \n --- Execution Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(params)}`
|
|
93
|
-
});
|
|
94
|
-
await (0, _powerlines_core_lib_context_helpers.resolvePluginConfig)(context);
|
|
95
|
-
const timer = context.timer("Preparation");
|
|
96
|
-
await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
|
|
97
|
-
env.debug(`Initializing the processing options for the Powerlines project.`);
|
|
98
|
-
await context.callHook("configResolved", {
|
|
99
|
-
environment: env,
|
|
100
|
-
order: "pre"
|
|
101
|
-
});
|
|
102
|
-
await (0, _powerlines_core.initializeTsconfig)(env);
|
|
103
|
-
await context.callHook("configResolved", {
|
|
104
|
-
environment: env,
|
|
105
|
-
order: "normal"
|
|
106
|
-
});
|
|
107
|
-
if (env.entry.length > 0) {
|
|
108
|
-
const entriesLength = (0, _stryke_type_checks_is_object.isObject)(env.config.input) ? Object.keys(env.config.input).length : (0, _stryke_convert_to_array.toArray)(env.config.input).length;
|
|
109
|
-
env.debug(`The configuration provided ${entriesLength} entry point${entriesLength !== 1 ? "s" : ""}, Powerlines has found ${env.entry.length} entry file${env.entry.length !== 1 ? "s" : ""} for the ${env.config.title} project${env.entry.length > 0 && env.entry.length < 10 ? `: \n${env.entry.map((entry) => `- ${(0, _stryke_path_replace.replacePath)(entry.file, context.config.root)}${entry.output ? ` -> ${(0, _stryke_path_replace.replacePath)(entry.output, context.config.root)}` : ""}`).join(" \n")}` : ""}`);
|
|
110
|
-
} else env.warn(`No entry files were found for the ${env.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
|
|
111
|
-
await (0, _powerlines_core.resolveTsconfig)(env);
|
|
112
|
-
await (0, _powerlines_core.installDependencies)(env);
|
|
113
|
-
await context.callHook("configResolved", {
|
|
114
|
-
environment: env,
|
|
115
|
-
order: "post"
|
|
116
|
-
});
|
|
117
|
-
env.trace({
|
|
118
|
-
meta: { category: "config" },
|
|
119
|
-
message: `Powerlines configuration after configResolved hook: \n${(0, _powerlines_core_plugin_utils.formatConfig)(env.config)}`
|
|
120
|
-
});
|
|
121
|
-
if (!env.fs.existsSync(env.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(env.cachePath);
|
|
122
|
-
if (!env.fs.existsSync(env.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(env.dataPath);
|
|
123
|
-
await context.callHook("prepare", {
|
|
124
|
-
environment: env,
|
|
125
|
-
order: "pre"
|
|
126
|
-
});
|
|
127
|
-
await context.callHook("prepare", {
|
|
128
|
-
environment: env,
|
|
129
|
-
order: "normal"
|
|
130
|
-
});
|
|
131
|
-
await context.callHook("prepare", {
|
|
132
|
-
environment: env,
|
|
133
|
-
order: "post"
|
|
134
|
-
});
|
|
135
|
-
if (env.config.output.types !== false) await (0, _powerlines_core.handleTypes)(context, env);
|
|
136
|
-
context.debug("Formatting files generated during the prepare step.");
|
|
137
|
-
await Promise.all([(0, _powerlines_core.formatFolder)(env, env.builtinsPath), (0, _powerlines_core.formatFolder)(env, env.entryPath)]);
|
|
138
|
-
await (0, _powerlines_core.writeMetaFile)(env);
|
|
139
|
-
env.persistedMeta = env.meta;
|
|
140
|
-
});
|
|
141
|
-
timer();
|
|
142
|
-
}
|
|
143
|
-
async function resolveId(id, importer, opts = { isEntry: false }) {
|
|
144
|
-
const normalizedId = (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(id);
|
|
145
|
-
const normalizedImporter = importer ? (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(importer) : void 0;
|
|
146
|
-
let result = await context.callHook("resolveId", {
|
|
147
|
-
sequential: true,
|
|
148
|
-
result: "first",
|
|
149
|
-
order: "pre"
|
|
150
|
-
}, normalizedId, normalizedImporter, opts);
|
|
151
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
152
|
-
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
153
|
-
...result,
|
|
154
|
-
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
155
|
-
};
|
|
156
|
-
result = await context.callHook("resolveId", {
|
|
157
|
-
sequential: true,
|
|
158
|
-
result: "first",
|
|
159
|
-
order: "normal"
|
|
160
|
-
}, normalizedId, normalizedImporter, opts);
|
|
161
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
162
|
-
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
163
|
-
...result,
|
|
164
|
-
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
165
|
-
};
|
|
166
|
-
result = await context.resolve(normalizedId, normalizedImporter, {
|
|
167
|
-
isFile: true,
|
|
168
|
-
...opts
|
|
169
|
-
});
|
|
170
|
-
if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
171
|
-
...result,
|
|
172
|
-
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
173
|
-
};
|
|
174
|
-
result = await context.callHook("resolveId", {
|
|
175
|
-
sequential: true,
|
|
176
|
-
result: "first",
|
|
177
|
-
order: "post"
|
|
178
|
-
}, normalizedId, normalizedImporter, opts);
|
|
179
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
180
|
-
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(result)) return {
|
|
181
|
-
...result,
|
|
182
|
-
id: result.virtual && virtualModulePrefix !== false ? (0, _powerlines_core_plugin_utils.addVirtualPrefix)(result.id) : result.id
|
|
183
|
-
};
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
const load = {
|
|
187
|
-
filter: virtualModulePrefix !== false ? { id: _powerlines_core_plugin_utils.VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
|
|
188
|
-
async handler(id) {
|
|
189
|
-
const normalizedId = (0, _powerlines_core_plugin_utils.removeVirtualPrefix)(id);
|
|
190
|
-
let result = await context.callHook("load", {
|
|
191
|
-
sequential: true,
|
|
192
|
-
result: "first",
|
|
193
|
-
order: "pre"
|
|
194
|
-
}, normalizedId);
|
|
195
|
-
if (result) return result;
|
|
196
|
-
result = await context.callHook("load", {
|
|
197
|
-
sequential: true,
|
|
198
|
-
result: "first",
|
|
199
|
-
order: "normal"
|
|
200
|
-
}, normalizedId);
|
|
201
|
-
if (result) return result;
|
|
202
|
-
result = await context.load(normalizedId);
|
|
203
|
-
if (result) return result;
|
|
204
|
-
return context.callHook("load", {
|
|
205
|
-
sequential: true,
|
|
206
|
-
result: "first",
|
|
207
|
-
order: "post"
|
|
208
|
-
}, normalizedId);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
async function transform(code, id) {
|
|
212
|
-
return context.callHook("transform", {
|
|
213
|
-
environment: await context.getEnvironment(),
|
|
214
|
-
result: "merge",
|
|
215
|
-
asNextParam: (previousResult) => (0, _powerlines_core_lib_utilities_source_file.getString)(previousResult)
|
|
216
|
-
}, (0, _powerlines_core_lib_utilities_source_file.getString)(code), id);
|
|
217
|
-
}
|
|
218
|
-
async function writeBundle() {
|
|
219
|
-
context.logger.debug("Finalizing Powerlines project output...");
|
|
220
|
-
await context.callHook("writeBundle", { environment: await context.getEnvironment() });
|
|
221
|
-
}
|
|
222
|
-
context.logger.debug("Unplugin initialized successfully.");
|
|
223
|
-
const result = {
|
|
224
|
-
name: `${(0, _stryke_string_format_kebab_case.kebabCase)(framework)}:${(0, _stryke_string_format_kebab_case.kebabCase)(options.variant)}-plugin`,
|
|
225
|
-
context,
|
|
226
|
-
resolveId,
|
|
227
|
-
load,
|
|
228
|
-
transform,
|
|
229
|
-
buildStart,
|
|
230
|
-
writeBundle
|
|
231
|
-
};
|
|
232
|
-
return {
|
|
233
|
-
...result,
|
|
234
|
-
...decorate(result)
|
|
235
|
-
};
|
|
236
|
-
} catch (error) {
|
|
237
|
-
if ((0, _stryke_type_checks_is_function.isFunction)(context?.logger?.error)) context.logger.error(error?.message);
|
|
238
|
-
throw error;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
2
|
+
const require_unplugin = require('./unplugin-WjPT9ECw.cjs');
|
|
242
3
|
|
|
243
|
-
|
|
244
|
-
exports.createUnpluginFactory = createUnpluginFactory;
|
|
245
|
-
Object.defineProperty(exports, 'unplugin_exports', {
|
|
246
|
-
enumerable: true,
|
|
247
|
-
get: function () {
|
|
248
|
-
return unplugin_exports;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
4
|
+
exports.createUnpluginFactory = require_unplugin.createUnpluginFactory;
|
|
251
5
|
var _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
252
6
|
Object.keys(_powerlines_core_lib_unplugin).forEach(function (k) {
|
|
253
7
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/unplugin.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnpluginFactory } from "./types.cjs";
|
|
1
|
+
import { a as __reExport, i as __exportAll, r as UnpluginFactory } from "./types-CEaXoKbk.cjs";
|
|
2
2
|
import { CustomLogger, ExecutionContext, Options, UnpluginBuilderVariant, UnpluginOptions } from "@powerlines/core";
|
|
3
3
|
export * from "@powerlines/core/lib/unplugin";
|
|
4
4
|
|
package/dist/unplugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;
|
|
1
|
+
{"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;EAAR;;;;;;EAOtC,OAAA,EAAS,sBAAA;EAPqC;;;;;EAc9C,mBAAA;EAQ2B;AAAA;AAG7B;;;;EAHE,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;;;;;;;;;;;;;AAAQ;AA2BrC;;;;;;;;;;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,EAEpC,OAAA,EAAS,sBAAA,EACT,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAClC,eAAA,CAAgB,QAAA"}
|
package/dist/unplugin.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 { UnpluginFactory } from "./types.mjs";
|
|
4
2
|
import { CustomLogger, ExecutionContext, Options, UnpluginBuilderVariant, UnpluginOptions } from "@powerlines/core";
|
|
5
3
|
export * from "@powerlines/core/lib/unplugin";
|
package/dist/unplugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;UAuEiB,sBAAA,SAA+B,OAAA;EAA/B;;;;;;EAOf,OAAA,EAAS,sBAAA;EAP4C;;;;;EAcrD,mBAAA;EAQe;;AAAY;AAG7B;;;EAHE,YAAA,GAAe,YAAA;AAAA;AAAA,KAGL,wBAAA,kBAA0C,gBAAA,KACpD,OAAA,EAAS,eAAA,CAAgB,QAAA,MACtB,OAAA,CAAQ,eAAA,CAAgB,QAAA;;;;;;;;;;;;;;;AAAQ;AA2BrC;;;;;;;;;;iBAAgB,qBAAA,kBACG,gBAAA,GAAmB,gBAAA,EAEpC,OAAA,EAAS,sBAAA,EACT,QAAA,GAAU,wBAAA,CAAyB,QAAA,IAClC,eAAA,CAAgB,QAAA"}
|