powerlines 0.45.3 → 0.46.0

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/engine.cjs CHANGED
@@ -14,13 +14,13 @@ let _powerlines_engine = require("@powerlines/engine");
14
14
  */
15
15
  var PowerlinesEngine = class extends _powerlines_engine.PowerlinesEngine {
16
16
  /**
17
- * Initialize a Powerlines Engine instance
17
+ * Create a new Powerlines Engine instance
18
18
  *
19
19
  * @param options - The options to initialize the context with
20
20
  * @returns A new instance of the Powerlines Engine
21
21
  */
22
- static async init(options) {
23
- const engine = await _powerlines_engine.PowerlinesEngine.init(options);
22
+ static async from(options) {
23
+ const engine = await _powerlines_engine.PowerlinesEngine.from(options);
24
24
  engine.context.info(`🔌 The Powerlines Engine v${require_package.version} has started`);
25
25
  return engine;
26
26
  }
package/dist/engine.d.cts CHANGED
@@ -12,12 +12,12 @@ import { PowerlinesEngine as PowerlinesEngine$1 } from "@powerlines/engine";
12
12
  */
13
13
  declare class PowerlinesEngine extends PowerlinesEngine$1 {
14
14
  /**
15
- * Initialize a Powerlines Engine instance
15
+ * Create a new Powerlines Engine instance
16
16
  *
17
17
  * @param options - The options to initialize the context with
18
18
  * @returns A new instance of the Powerlines Engine
19
19
  */
20
- static init(options: types_d_exports.EngineOptions): Promise<PowerlinesEngine>;
20
+ static from(options: types_d_exports.EngineOptions): Promise<PowerlinesEngine>;
21
21
  }
22
22
  //#endregion
23
23
  export { PowerlinesEngine };
package/dist/engine.d.mts CHANGED
@@ -12,12 +12,12 @@ import { PowerlinesEngine as PowerlinesEngine$1 } from "@powerlines/engine";
12
12
  */
13
13
  declare class PowerlinesEngine extends PowerlinesEngine$1 {
14
14
  /**
15
- * Initialize a Powerlines Engine instance
15
+ * Create a new Powerlines Engine instance
16
16
  *
17
17
  * @param options - The options to initialize the context with
18
18
  * @returns A new instance of the Powerlines Engine
19
19
  */
20
- static init(options: types_d_exports.EngineOptions): Promise<PowerlinesEngine>;
20
+ static from(options: types_d_exports.EngineOptions): Promise<PowerlinesEngine>;
21
21
  }
22
22
  //#endregion
23
23
  export { PowerlinesEngine };
package/dist/engine.mjs CHANGED
@@ -12,13 +12,13 @@ import { PowerlinesEngine as PowerlinesEngine$1 } from "@powerlines/engine";
12
12
  */
13
13
  var PowerlinesEngine = class extends PowerlinesEngine$1 {
14
14
  /**
15
- * Initialize a Powerlines Engine instance
15
+ * Create a new Powerlines Engine instance
16
16
  *
17
17
  * @param options - The options to initialize the context with
18
18
  * @returns A new instance of the Powerlines Engine
19
19
  */
20
- static async init(options) {
21
- const engine = await PowerlinesEngine$1.init(options);
20
+ static async from(options) {
21
+ const engine = await PowerlinesEngine$1.from(options);
22
22
  engine.context.info(`🔌 The Powerlines Engine v${version} has started`);
23
23
  return engine;
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"engine.mjs","names":["InternalPowerlinesEngine","packageJson.version"],"sources":["../src/engine.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 { PowerlinesEngine as InternalPowerlinesEngine } from \"@powerlines/engine\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport type { EngineOptions } from \"./types\";\n\n/**\n * The Powerlines Engine class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesEngine extends InternalPowerlinesEngine {\n /**\n * Initialize a Powerlines Engine instance\n *\n * @param options - The options to initialize the context with\n * @returns A new instance of the Powerlines Engine\n */\n public static override async init(\n options: EngineOptions\n ): Promise<PowerlinesEngine> {\n const engine = await InternalPowerlinesEngine.init(options);\n\n engine.context.info(\n `🔌 The Powerlines Engine v${packageJson.version} has started`\n );\n\n return engine;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,mBAAb,cAAsCA,mBAAyB;;;;;;;CAO7D,aAA6B,KAC3B,SAC2B;EAC3B,MAAM,SAAS,MAAMA,mBAAyB,KAAK,QAAQ;AAE3D,SAAO,QAAQ,KACb,6BAA6BC,QAAoB,cAClD;AAED,SAAO"}
1
+ {"version":3,"file":"engine.mjs","names":["InternalPowerlinesEngine","packageJson.version"],"sources":["../src/engine.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 { PowerlinesEngine as InternalPowerlinesEngine } from \"@powerlines/engine\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport type { EngineOptions } from \"./types\";\n\n/**\n * The Powerlines Engine class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesEngine extends InternalPowerlinesEngine {\n /**\n * Create a new Powerlines Engine instance\n *\n * @param options - The options to initialize the context with\n * @returns A new instance of the Powerlines Engine\n */\n public static override async from(\n options: EngineOptions\n ): Promise<PowerlinesEngine> {\n const engine = await InternalPowerlinesEngine.from(options);\n\n engine.context.info(\n `🔌 The Powerlines Engine v${packageJson.version} has started`\n );\n\n return engine;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,mBAAb,cAAsCA,mBAAyB;;;;;;;CAO7D,aAA6B,KAC3B,SAC2B;EAC3B,MAAM,SAAS,MAAMA,mBAAyB,KAAK,QAAQ;AAE3D,SAAO,QAAQ,KACb,6BAA6BC,QAAoB,cAClD;AAED,SAAO"}
package/dist/index.cjs CHANGED
@@ -20,7 +20,7 @@ let _powerlines_engine_api = require("@powerlines/engine/api");
20
20
  * @returns A promise that resolves to a {@link PowerlinesEngine} instance.
21
21
  */
22
22
  async function createEngine(options) {
23
- return require_engine.PowerlinesEngine.init(options);
23
+ return require_engine.PowerlinesEngine.from(options);
24
24
  }
25
25
  /**
26
26
  * Creates a new {@link PowerlinesAPI} instance.
@@ -29,7 +29,7 @@ async function createEngine(options) {
29
29
  * @returns A promise that resolves to a {@link PowerlinesAPI} instance.
30
30
  */
31
31
  async function createAPI(options) {
32
- return _powerlines_engine_api.PowerlinesAPI.init({
32
+ return _powerlines_engine_api.PowerlinesAPI.from({
33
33
  cwd: process.cwd(),
34
34
  ...options
35
35
  });
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import { PowerlinesEngine } from "./engine.mjs";
17
17
  * @returns A promise that resolves to a {@link PowerlinesEngine} instance.
18
18
  */
19
19
  async function createEngine(options) {
20
- return PowerlinesEngine.init(options);
20
+ return PowerlinesEngine.from(options);
21
21
  }
22
22
  /**
23
23
  * Creates a new {@link PowerlinesAPI} instance.
@@ -26,7 +26,7 @@ async function createEngine(options) {
26
26
  * @returns A promise that resolves to a {@link PowerlinesAPI} instance.
27
27
  */
28
28
  async function createAPI(options) {
29
- return PowerlinesAPI.init({
29
+ return PowerlinesAPI.from({
30
30
  cwd: process.cwd(),
31
31
  ...options
32
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * The powerlines library used by Storm Software for building NodeJS applications.\n *\n * @remarks\n * A build toolkit and runtime used by Storm Software in TypeScript applications\n *\n * @packageDocumentation\n */\n\nimport { PowerlinesAPI } from \"./api\";\nimport { PowerlinesEngine } from \"./engine\";\nimport type { EngineOptions, ResolvedConfig } from \"./types\";\n\nexport type * from \"./types\";\n\n/**\n * Creates a new {@link PowerlinesEngine} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link PowerlinesEngine} instance.\n */\nexport async function createEngine(\n options: EngineOptions\n): Promise<PowerlinesEngine> {\n return PowerlinesEngine.init(options);\n}\n\n/**\n * Creates a new {@link PowerlinesAPI} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link PowerlinesAPI} instance.\n */\nexport async function createAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(options: EngineOptions): Promise<PowerlinesAPI<TResolvedConfig>> {\n return PowerlinesAPI.init({ cwd: process.cwd(), ...options });\n}\n\nexport { PowerlinesAPI, PowerlinesEngine };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,eAAsB,aACpB,SAC2B;AAC3B,QAAO,iBAAiB,KAAK,QAAQ;;;;;;;;AASvC,eAAsB,UAEpB,SAAiE;AACjE,QAAO,cAAc,KAAK;EAAE,KAAK,QAAQ,KAAK;EAAE,GAAG;EAAS,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * The powerlines library used by Storm Software for building NodeJS applications.\n *\n * @remarks\n * A build toolkit and runtime used by Storm Software in TypeScript applications\n *\n * @packageDocumentation\n */\n\nimport { PowerlinesAPI } from \"./api\";\nimport { PowerlinesEngine } from \"./engine\";\nimport type { EngineOptions, ResolvedConfig } from \"./types\";\n\nexport type * from \"./types\";\n\n/**\n * Creates a new {@link PowerlinesEngine} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link PowerlinesEngine} instance.\n */\nexport async function createEngine(\n options: EngineOptions\n): Promise<PowerlinesEngine> {\n return PowerlinesEngine.from(options);\n}\n\n/**\n * Creates a new {@link PowerlinesAPI} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link PowerlinesAPI} instance.\n */\nexport async function createAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(options: EngineOptions): Promise<PowerlinesAPI<TResolvedConfig>> {\n return PowerlinesAPI.from({ cwd: process.cwd(), ...options });\n}\n\nexport { PowerlinesAPI, PowerlinesEngine };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,eAAsB,aACpB,SAC2B;AAC3B,QAAO,iBAAiB,KAAK,QAAQ;;;;;;;;AASvC,eAAsB,UAEpB,SAAiE;AACjE,QAAO,cAAc,KAAK;EAAE,KAAK,QAAQ,KAAK;EAAE,GAAG;EAAS,CAAC"}
package/dist/package.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  //#region package.json
3
3
  var name = "powerlines";
4
- var version = "0.45.3";
4
+ var version = "0.46.0";
5
5
 
6
6
  //#endregion
7
7
  Object.defineProperty(exports, 'name', {
package/dist/package.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "powerlines";
3
- var version = "0.45.3";
3
+ var version = "0.46.0";
4
4
 
5
5
  //#endregion
6
6
  export { name, version };
package/dist/unplugin.cjs CHANGED
@@ -27,7 +27,7 @@ function createUnpluginFactory(variant, decorate) {
27
27
  };
28
28
  let api;
29
29
  async function buildStart() {
30
- api = await _powerlines_engine_api.PowerlinesAPI.init({
30
+ api = await _powerlines_engine_api.PowerlinesAPI.from({
31
31
  ...options,
32
32
  cwd: (0, _stryke_fs_get_workspace_root.getWorkspaceRoot)(process.cwd()),
33
33
  root: initialConfig.root,
@@ -35,8 +35,7 @@ function createUnpluginFactory(variant, decorate) {
35
35
  }, initialConfig);
36
36
  logger = api.context.logger;
37
37
  logger.debug("Powerlines build plugin starting...");
38
- await api.context.setup();
39
- (0, unplugin.setParseImpl)(api.context.parse);
38
+ (0, unplugin.setParseImpl)(api.context.parse.bind(api.context));
40
39
  logger.debug("Preparing build artifacts for the Powerlines project...");
41
40
  await api.prepare({ command: "build" });
42
41
  }
@@ -1,5 +1,5 @@
1
1
  import { PowerlinesAPI } from "./api.cjs";
2
- import { Context, UnpluginBuilderVariant, UnpluginFactory, UnpluginOptions } from "@powerlines/core";
2
+ import { PluginContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginOptions } from "@powerlines/core";
3
3
  import { UnpluginOptions as UnpluginOptions$1 } from "unplugin";
4
4
  export * from "@powerlines/core/lib/unplugin";
5
5
 
@@ -11,7 +11,7 @@ export * from "@powerlines/core/lib/unplugin";
11
11
  * @param decorate - An optional function to decorate the unplugin options.
12
12
  * @returns The unplugin factory that generates a plugin instance.
13
13
  */
14
- declare function createUnpluginFactory<TContext extends Context, TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant>(variant: TUnpluginBuilderVariant, decorate?: (api: PowerlinesAPI<TContext["config"]>, plugin: UnpluginOptions<TContext>) => UnpluginOptions$1): UnpluginFactory<TContext>;
14
+ declare function createUnpluginFactory<TContext extends PluginContext, TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant>(variant: TUnpluginBuilderVariant, decorate?: (api: PowerlinesAPI<TContext["config"]>, plugin: UnpluginOptions<TContext>) => UnpluginOptions$1): UnpluginFactory<TContext>;
15
15
  //#endregion
16
16
  export { createUnpluginFactory };
17
17
  //# sourceMappingURL=unplugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;AA8CA;;;;iBAAgB,qBAAA,kBACG,OAAA,kCACe,sBAAA,GAC9B,sBAAA,CAAA,CAEF,OAAA,EAAS,uBAAA,EACT,QAAA,IACE,GAAA,EAAK,aAAA,CAAc,QAAA,aACnB,MAAA,EAAQ,eAAA,CAAgB,QAAA,MACrB,iBAAA,GACJ,eAAA,CAAgB,QAAA"}
1
+ {"version":3,"file":"unplugin.d.cts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;AA8CA;;;;iBAAgB,qBAAA,kBACG,aAAA,kCACe,sBAAA,GAC9B,sBAAA,CAAA,CAEF,OAAA,EAAS,uBAAA,EACT,QAAA,IACE,GAAA,EAAK,aAAA,CAAc,QAAA,aACnB,MAAA,EAAQ,eAAA,CAAgB,QAAA,MACrB,iBAAA,GACJ,eAAA,CAAgB,QAAA"}
@@ -1,6 +1,6 @@
1
1
  import { PowerlinesAPI } from "./api.mjs";
2
2
  import { UnpluginOptions } from "unplugin";
3
- import { Context, UnpluginBuilderVariant, UnpluginFactory, UnpluginOptions as UnpluginOptions$1 } from "@powerlines/core";
3
+ import { PluginContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginOptions as UnpluginOptions$1 } from "@powerlines/core";
4
4
  export * from "@powerlines/core/lib/unplugin";
5
5
 
6
6
  //#region src/unplugin.d.ts
@@ -11,7 +11,7 @@ export * from "@powerlines/core/lib/unplugin";
11
11
  * @param decorate - An optional function to decorate the unplugin options.
12
12
  * @returns The unplugin factory that generates a plugin instance.
13
13
  */
14
- declare function createUnpluginFactory<TContext extends Context, TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant>(variant: TUnpluginBuilderVariant, decorate?: (api: PowerlinesAPI<TContext["config"]>, plugin: UnpluginOptions$1<TContext>) => UnpluginOptions): UnpluginFactory<TContext>;
14
+ declare function createUnpluginFactory<TContext extends PluginContext, TUnpluginBuilderVariant extends UnpluginBuilderVariant = UnpluginBuilderVariant>(variant: TUnpluginBuilderVariant, decorate?: (api: PowerlinesAPI<TContext["config"]>, plugin: UnpluginOptions$1<TContext>) => UnpluginOptions): UnpluginFactory<TContext>;
15
15
  //#endregion
16
16
  export { createUnpluginFactory };
17
17
  //# sourceMappingURL=unplugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;AA8CA;;;;iBAAgB,qBAAA,kBACG,OAAA,kCACe,sBAAA,GAC9B,sBAAA,CAAA,CAEF,OAAA,EAAS,uBAAA,EACT,QAAA,IACE,GAAA,EAAK,aAAA,CAAc,QAAA,aACnB,MAAA,EAAQ,iBAAA,CAAgB,QAAA,MACrB,eAAA,GACJ,eAAA,CAAgB,QAAA"}
1
+ {"version":3,"file":"unplugin.d.mts","names":[],"sources":["../src/unplugin.ts"],"mappings":";;;;;;;;;AA8CA;;;;iBAAgB,qBAAA,kBACG,aAAA,kCACe,sBAAA,GAC9B,sBAAA,CAAA,CAEF,OAAA,EAAS,uBAAA,EACT,QAAA,IACE,GAAA,EAAK,aAAA,CAAc,QAAA,aACnB,MAAA,EAAQ,iBAAA,CAAgB,QAAA,MACrB,eAAA,GACJ,eAAA,CAAgB,QAAA"}
package/dist/unplugin.mjs CHANGED
@@ -26,7 +26,7 @@ function createUnpluginFactory(variant, decorate) {
26
26
  };
27
27
  let api;
28
28
  async function buildStart() {
29
- api = await PowerlinesAPI.init({
29
+ api = await PowerlinesAPI.from({
30
30
  ...options,
31
31
  cwd: getWorkspaceRoot(process.cwd()),
32
32
  root: initialConfig.root,
@@ -34,8 +34,7 @@ function createUnpluginFactory(variant, decorate) {
34
34
  }, initialConfig);
35
35
  logger = api.context.logger;
36
36
  logger.debug("Powerlines build plugin starting...");
37
- await api.context.setup();
38
- setParseImpl(api.context.parse);
37
+ setParseImpl(api.context.parse.bind(api.context));
39
38
  logger.debug("Preparing build artifacts for the Powerlines project...");
40
39
  await api.prepare({ command: "build" });
41
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n Context,\n UnpluginBuilderVariant,\n UnpluginFactory,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport { createLogger } from \"@powerlines/core/plugin-utils/logging\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n UnpluginOptions as BaseUnpluginOptions,\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { PowerlinesAPI } from \"./api\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @param variant - The build variant for which to create the unplugin.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends Context,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n variant: TUnpluginBuilderVariant,\n decorate?: (\n api: PowerlinesAPI<TContext[\"config\"]>,\n plugin: UnpluginOptions<TContext>\n ) => BaseUnpluginOptions\n): UnpluginFactory<TContext> {\n return (options, meta): UnpluginOptions<TContext> => {\n let logger = createLogger(options.name || \"powerlines\", {});\n logger.debug(\"Initializing Unplugin\");\n\n try {\n const initialConfig = {\n ...options,\n variant,\n unplugin: meta\n };\n\n let api!: PowerlinesAPI<TContext[\"config\"]>;\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n api = await PowerlinesAPI.init(\n {\n ...options,\n cwd: getWorkspaceRoot(process.cwd()),\n root: initialConfig.root,\n mode: initialConfig.mode\n },\n initialConfig\n );\n\n logger = api.context.logger;\n logger.debug(\"Powerlines build plugin starting...\");\n\n await api.context.setup();\n\n setParseImpl(api.context.parse);\n\n logger.debug(\"Preparing build artifacts for the Powerlines project...\");\n\n await api.prepare({\n command: \"build\"\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n options: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n return api.context.resolve(id, importer, options);\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult> {\n const environment = await api.context.getEnvironment();\n\n let result = await api.callHook(\n \"load\",\n { environment, order: \"pre\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await api.callHook(\n \"load\",\n { environment, order: \"normal\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await environment.load(id);\n if (result) {\n return result;\n }\n\n return api.callHook(\"load\", { environment, order: \"post\" }, id);\n }\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return api.callHook(\n \"transform\",\n {\n environment: await api.context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n logger.debug(\"Finalizing Powerlines project output...\");\n\n await api.callHook(\"writeBundle\", {\n environment: await api.context.getEnvironment()\n });\n }\n\n const unpluginOptions = {\n name: \"powerlines\",\n api,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as UnpluginOptions<TContext>;\n\n const result = decorate\n ? decorate(api, unpluginOptions)\n : unpluginOptions;\n\n logger.debug(\"Unplugin initialized successfully.\");\n\n return { api, ...result };\n } catch (error) {\n logger.error((error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,SAAgB,sBAKd,SACA,UAI2B;AAC3B,SAAQ,SAAS,SAAoC;EACnD,IAAI,SAAS,aAAa,QAAQ,QAAQ,cAAc,EAAE,CAAC;AAC3D,SAAO,MAAM,wBAAwB;AAErC,MAAI;GACF,MAAM,gBAAgB;IACpB,GAAG;IACH;IACA,UAAU;IACX;GAED,IAAI;GAEJ,eAAe,aAAsD;AACnE,UAAM,MAAM,cAAc,KACxB;KACE,GAAG;KACH,KAAK,iBAAiB,QAAQ,KAAK,CAAC;KACpC,MAAM,cAAc;KACpB,MAAM,cAAc;KACrB,EACD,cACD;AAED,aAAS,IAAI,QAAQ;AACrB,WAAO,MAAM,sCAAsC;AAEnD,UAAM,IAAI,QAAQ,OAAO;AAEzB,iBAAa,IAAI,QAAQ,MAAM;AAE/B,WAAO,MAAM,0DAA0D;AAEvE,UAAM,IAAI,QAAQ,EAChB,SAAS,SACV,CAAC;;GAGJ,eAAe,UAEb,IACA,UACA,UAEI,EAAE,SAAS,OAAO,EACtB;AACA,WAAO,IAAI,QAAQ,QAAQ,IAAI,UAAU,QAAQ;;GAGnD,eAAe,KAEb,IACqB;IACrB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;IAEtD,IAAI,SAAS,MAAM,IAAI,SACrB,QACA;KAAE;KAAa,OAAO;KAAO,EAC7B,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,SACjB,QACA;KAAE;KAAa,OAAO;KAAU,EAChC,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,YAAY,KAAK,GAAG;AACnC,QAAI,OACF,QAAO;AAGT,WAAO,IAAI,SAAS,QAAQ;KAAE;KAAa,OAAO;KAAQ,EAAE,GAAG;;GAGjE,eAAe,UACb,MACA,IAC0B;AAC1B,WAAO,IAAI,SACT,aACA;KACE,aAAa,MAAM,IAAI,QAAQ,gBAAgB;KAC/C,QAAQ;KACR,cAAa,mBAAkB,UAAU,eAAe;KACzD,EACD,UAAU,KAAK,EACf,GACD;;GAGH,eAAe,cAA6B;AAC1C,WAAO,MAAM,0CAA0C;AAEvD,UAAM,IAAI,SAAS,eAAe,EAChC,aAAa,MAAM,IAAI,QAAQ,gBAAgB,EAChD,CAAC;;GAGJ,MAAM,kBAAkB;IACtB,MAAM;IACN;IACA;IACA;IACA;IACA;IACA;IACD;GAED,MAAM,SAAS,WACX,SAAS,KAAK,gBAAgB,GAC9B;AAEJ,UAAO,MAAM,qCAAqC;AAElD,UAAO;IAAE;IAAK,GAAG;IAAQ;WAClB,OAAO;AACd,UAAO,MAAO,OAAiB,QAAQ;AAEvC,SAAM"}
1
+ {"version":3,"file":"unplugin.mjs","names":[],"sources":["../src/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n PluginContext,\n UnpluginBuilderVariant,\n UnpluginFactory,\n UnpluginOptions\n} from \"@powerlines/core\";\nimport { getString } from \"@powerlines/core/lib/utilities/source-file\";\nimport { createLogger } from \"@powerlines/core/plugin-utils/logging\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { LoadResult } from \"rolldown\";\nimport type {\n UnpluginOptions as BaseUnpluginOptions,\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { PowerlinesAPI } from \"./api\";\n\nexport * from \"@powerlines/core/lib/unplugin\";\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @param variant - The build variant for which to create the unplugin.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TContext extends PluginContext,\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n variant: TUnpluginBuilderVariant,\n decorate?: (\n api: PowerlinesAPI<TContext[\"config\"]>,\n plugin: UnpluginOptions<TContext>\n ) => BaseUnpluginOptions\n): UnpluginFactory<TContext> {\n return (options, meta): UnpluginOptions<TContext> => {\n let logger = createLogger(options.name || \"powerlines\", {});\n logger.debug(\"Initializing Unplugin\");\n\n try {\n const initialConfig = {\n ...options,\n variant,\n unplugin: meta\n };\n\n let api!: PowerlinesAPI<TContext[\"config\"]>;\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n api = await PowerlinesAPI.from(\n {\n ...options,\n cwd: getWorkspaceRoot(process.cwd()),\n root: initialConfig.root,\n mode: initialConfig.mode\n },\n initialConfig\n );\n\n logger = api.context.logger;\n logger.debug(\"Powerlines build plugin starting...\");\n\n setParseImpl(api.context.parse.bind(api.context));\n\n logger.debug(\"Preparing build artifacts for the Powerlines project...\");\n\n await api.prepare({\n command: \"build\"\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n options: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n return api.context.resolve(id, importer, options);\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult> {\n const environment = await api.context.getEnvironment();\n\n let result = await api.callHook(\n \"load\",\n { environment, order: \"pre\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await api.callHook(\n \"load\",\n { environment, order: \"normal\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await environment.load(id);\n if (result) {\n return result;\n }\n\n return api.callHook(\"load\", { environment, order: \"post\" }, id);\n }\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return api.callHook(\n \"transform\",\n {\n environment: await api.context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n logger.debug(\"Finalizing Powerlines project output...\");\n\n await api.callHook(\"writeBundle\", {\n environment: await api.context.getEnvironment()\n });\n }\n\n const unpluginOptions = {\n name: \"powerlines\",\n api,\n resolveId,\n load,\n transform,\n buildStart,\n writeBundle\n } as UnpluginOptions<TContext>;\n\n const result = decorate\n ? decorate(api, unpluginOptions)\n : unpluginOptions;\n\n logger.debug(\"Unplugin initialized successfully.\");\n\n return { api, ...result };\n } catch (error) {\n logger.error((error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,SAAgB,sBAKd,SACA,UAI2B;AAC3B,SAAQ,SAAS,SAAoC;EACnD,IAAI,SAAS,aAAa,QAAQ,QAAQ,cAAc,EAAE,CAAC;AAC3D,SAAO,MAAM,wBAAwB;AAErC,MAAI;GACF,MAAM,gBAAgB;IACpB,GAAG;IACH;IACA,UAAU;IACX;GAED,IAAI;GAEJ,eAAe,aAAsD;AACnE,UAAM,MAAM,cAAc,KACxB;KACE,GAAG;KACH,KAAK,iBAAiB,QAAQ,KAAK,CAAC;KACpC,MAAM,cAAc;KACpB,MAAM,cAAc;KACrB,EACD,cACD;AAED,aAAS,IAAI,QAAQ;AACrB,WAAO,MAAM,sCAAsC;AAEnD,iBAAa,IAAI,QAAQ,MAAM,KAAK,IAAI,QAAQ,CAAC;AAEjD,WAAO,MAAM,0DAA0D;AAEvE,UAAM,IAAI,QAAQ,EAChB,SAAS,SACV,CAAC;;GAGJ,eAAe,UAEb,IACA,UACA,UAEI,EAAE,SAAS,OAAO,EACtB;AACA,WAAO,IAAI,QAAQ,QAAQ,IAAI,UAAU,QAAQ;;GAGnD,eAAe,KAEb,IACqB;IACrB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;IAEtD,IAAI,SAAS,MAAM,IAAI,SACrB,QACA;KAAE;KAAa,OAAO;KAAO,EAC7B,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,IAAI,SACjB,QACA;KAAE;KAAa,OAAO;KAAU,EAChC,GACD;AACD,QAAI,OACF,QAAO;AAGT,aAAS,MAAM,YAAY,KAAK,GAAG;AACnC,QAAI,OACF,QAAO;AAGT,WAAO,IAAI,SAAS,QAAQ;KAAE;KAAa,OAAO;KAAQ,EAAE,GAAG;;GAGjE,eAAe,UACb,MACA,IAC0B;AAC1B,WAAO,IAAI,SACT,aACA;KACE,aAAa,MAAM,IAAI,QAAQ,gBAAgB;KAC/C,QAAQ;KACR,cAAa,mBAAkB,UAAU,eAAe;KACzD,EACD,UAAU,KAAK,EACf,GACD;;GAGH,eAAe,cAA6B;AAC1C,WAAO,MAAM,0CAA0C;AAEvD,UAAM,IAAI,SAAS,eAAe,EAChC,aAAa,MAAM,IAAI,QAAQ,gBAAgB,EAChD,CAAC;;GAGJ,MAAM,kBAAkB;IACtB,MAAM;IACN;IACA;IACA;IACA;IACA;IACA;IACD;GAED,MAAM,SAAS,WACX,SAAS,KAAK,gBAAgB,GAC9B;AAEJ,UAAO,MAAM,qCAAqC;AAElD,UAAO;IAAE;IAAK,GAAG;IAAQ;WAClB,OAAO;AACd,UAAO,MAAO,OAAiB,QAAQ;AAEvC,SAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerlines",
3
- "version": "0.45.3",
3
+ "version": "0.46.0",
4
4
  "private": false,
5
5
  "description": "The \"framework framework\" that simplifies modern dev tool usage, generates virtual (or actual) code modules, and improves DX across the board.",
6
6
  "keywords": [
@@ -373,19 +373,19 @@
373
373
  "files": ["dist/**/*", "files/**/*", "schemas/**/*"],
374
374
  "dependencies": {
375
375
  "@babel/types": "8.0.0-rc.4",
376
- "@powerlines/core": "^0.45.3",
377
- "@powerlines/engine": "^0.45.3",
376
+ "@powerlines/core": "^0.46.0",
377
+ "@powerlines/engine": "^0.46.0",
378
378
  "@storm-software/config": "^1.137.34",
379
379
  "@storm-software/config-tools": "^1.190.1",
380
- "@stryke/fs": "^0.33.69",
381
- "@stryke/convert": "^0.7.2",
382
- "@stryke/env": "^0.20.86",
380
+ "@stryke/fs": "^0.33.70",
381
+ "@stryke/convert": "^0.7.3",
382
+ "@stryke/env": "^0.20.87",
383
383
  "defu": "^6.1.7",
384
384
  "unplugin": "^3.0.0"
385
385
  },
386
386
  "devDependencies": {
387
387
  "@storm-software/testing-tools": "^1.119.155",
388
- "@stryke/types": "^0.11.6",
388
+ "@stryke/types": "^0.12.0",
389
389
  "@types/node": "^25.6.0",
390
390
  "typescript": "^6.0.3",
391
391
  "undici-types": "^7.25.0"
@@ -441,5 +441,5 @@
441
441
  },
442
442
  "publishConfig": { "access": "public" },
443
443
  "bin": { "powerlines": "./bin/bin.mjs" },
444
- "gitHead": "8bd8d3c0e34fa7d04dafa0f05d740e5246a713cb"
444
+ "gitHead": "c6c77589e59dbcee5e9dc45132411b04d0e895df"
445
445
  }