@powerlines/plugin-pulumi 0.2.97 → 0.2.98

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.
@@ -1 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region rolldown:runtime
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs CHANGED
@@ -1 +1,53 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines/src/plugin-utils/context-helpers.cjs`);let n=require(`@pulumi/pulumi/automation`),r=require(`@stryke/helpers/index`),i=require(`@stryke/path/join`),a=require(`@stryke/string-format/kebab-case`),o=require(`defu`);o=e.__toESM(o);const s=(e={})=>({name:`pulumi`,async config(){return{deploy:{pulumi:(0,o.default)(e,{projectName:this.config.name,workDir:(0,i.joinPaths)(this.artifactsPath,`infrastructure`),settings:{}})}}},async configResolved(){e.stack||(this.config.deploy.pulumi.stackName??=(0,n.fullyQualifiedStackName)((0,a.kebabCase)(t.getOrganizationName(this)||`default`),`${t.getWorkspaceName(this)?`${(0,a.kebabCase)(t.getWorkspaceName(this))}-`:``}${(0,a.kebabCase)(this.config.name)}`,this.config.mode))},deploy:{order:`post`,async handler(){if(this.info(`Deploying Pulumi stack: ${this.config.deploy.pulumi.stack?.name||this.config.deploy.pulumi.stackName}`),!e.stack&&!e.program&&!e.projectName||!e.workDir)throw Error(`Pulumi plugin requires either an inline program or a working directory to be specified.`);let t=e.stack;t??=await n.LocalWorkspace.createOrSelectStack((0,r.omit)(this.config.deploy.pulumi,[`options`,`settings`])),this.config.deploy.pulumi.settings&&Object.keys(this.config.deploy.pulumi.settings).length>0&&await t.workspace.saveStackSettings(t.name,this.config.deploy.pulumi.settings),await t.refresh({onOutput:this.debug.bind(this)}),this.config.deploy.pulumi.destroy&&await t.destroy({onOutput:this.debug.bind(this)});let i=await t.up({onOutput:this.debug.bind(this)});this.info(`Successfully deployed ${t.name} (v${i.summary.version}): ${i.summary.message}`)}}});var c=s;exports.default=c,exports.plugin=s;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_context_helpers = require('./powerlines/src/plugin-utils/context-helpers.cjs');
4
+ let __pulumi_pulumi_automation = require("@pulumi/pulumi/automation");
5
+ let __stryke_helpers_index = require("@stryke/helpers/index");
6
+ let __stryke_path_join = require("@stryke/path/join");
7
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
8
+ let defu = require("defu");
9
+ defu = require_rolldown_runtime.__toESM(defu);
10
+
11
+ //#region src/index.ts
12
+ /**
13
+ * A package containing a Powerlines plugin to configure infrastructure and deploy a project using Pulumi IaC.
14
+ *
15
+ * @see https://www.pulumi.com
16
+ *
17
+ * @param options - The Pulumi plugin user configuration options.
18
+ * @returns A Powerlines plugin to configure infrastructure and deploy a project using Pulumi.
19
+ */
20
+ const plugin = (options = {}) => {
21
+ return {
22
+ name: "pulumi",
23
+ async config() {
24
+ return { deploy: { pulumi: (0, defu.default)(options, {
25
+ projectName: this.config.name,
26
+ workDir: (0, __stryke_path_join.joinPaths)(this.artifactsPath, "infrastructure"),
27
+ settings: {}
28
+ }) } };
29
+ },
30
+ async configResolved() {
31
+ if (!options.stack) this.config.deploy.pulumi.stackName ??= (0, __pulumi_pulumi_automation.fullyQualifiedStackName)((0, __stryke_string_format_kebab_case.kebabCase)(require_context_helpers.getOrganizationName(this) || "default"), `${require_context_helpers.getWorkspaceName(this) ? `${(0, __stryke_string_format_kebab_case.kebabCase)(require_context_helpers.getWorkspaceName(this))}-` : ""}${(0, __stryke_string_format_kebab_case.kebabCase)(this.config.name)}`, this.config.mode);
32
+ },
33
+ deploy: {
34
+ order: "post",
35
+ async handler() {
36
+ this.info(`Deploying Pulumi stack: ${this.config.deploy.pulumi.stack?.name || this.config.deploy.pulumi.stackName}`);
37
+ if (!options.stack && !options.program && !options.projectName || !options.workDir) throw new Error(`Pulumi plugin requires either an inline program or a working directory to be specified.`);
38
+ let stack = options.stack;
39
+ stack ??= await __pulumi_pulumi_automation.LocalWorkspace.createOrSelectStack((0, __stryke_helpers_index.omit)(this.config.deploy.pulumi, ["options", "settings"]));
40
+ if (this.config.deploy.pulumi.settings && Object.keys(this.config.deploy.pulumi.settings).length > 0) await stack.workspace.saveStackSettings(stack.name, this.config.deploy.pulumi.settings);
41
+ await stack.refresh({ onOutput: this.debug.bind(this) });
42
+ if (this.config.deploy.pulumi.destroy) await stack.destroy({ onOutput: this.debug.bind(this) });
43
+ const result = await stack.up({ onOutput: this.debug.bind(this) });
44
+ this.info(`Successfully deployed ${stack.name} (v${result.summary.version}): ${result.summary.message}`);
45
+ }
46
+ }
47
+ };
48
+ };
49
+ var src_default = plugin;
50
+
51
+ //#endregion
52
+ exports.default = src_default;
53
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,49 @@
1
- import{getOrganizationName as e,getWorkspaceName as t}from"./powerlines/src/plugin-utils/context-helpers.mjs";import{LocalWorkspace as n,fullyQualifiedStackName as r}from"@pulumi/pulumi/automation";import{omit as i}from"@stryke/helpers/index";import{joinPaths as a}from"@stryke/path/join";import{kebabCase as o}from"@stryke/string-format/kebab-case";import s from"defu";const c=(c={})=>({name:`pulumi`,async config(){return{deploy:{pulumi:s(c,{projectName:this.config.name,workDir:a(this.artifactsPath,`infrastructure`),settings:{}})}}},async configResolved(){c.stack||(this.config.deploy.pulumi.stackName??=r(o(e(this)||`default`),`${t(this)?`${o(t(this))}-`:``}${o(this.config.name)}`,this.config.mode))},deploy:{order:`post`,async handler(){if(this.info(`Deploying Pulumi stack: ${this.config.deploy.pulumi.stack?.name||this.config.deploy.pulumi.stackName}`),!c.stack&&!c.program&&!c.projectName||!c.workDir)throw Error(`Pulumi plugin requires either an inline program or a working directory to be specified.`);let e=c.stack;e??=await n.createOrSelectStack(i(this.config.deploy.pulumi,[`options`,`settings`])),this.config.deploy.pulumi.settings&&Object.keys(this.config.deploy.pulumi.settings).length>0&&await e.workspace.saveStackSettings(e.name,this.config.deploy.pulumi.settings),await e.refresh({onOutput:this.debug.bind(this)}),this.config.deploy.pulumi.destroy&&await e.destroy({onOutput:this.debug.bind(this)});let t=await e.up({onOutput:this.debug.bind(this)});this.info(`Successfully deployed ${e.name} (v${t.summary.version}): ${t.summary.message}`)}}});var l=c;export{l as default,c as plugin};
1
+ import { getOrganizationName, getWorkspaceName } from "./powerlines/src/plugin-utils/context-helpers.mjs";
2
+ import { LocalWorkspace, fullyQualifiedStackName } from "@pulumi/pulumi/automation";
3
+ import { omit } from "@stryke/helpers/index";
4
+ import { joinPaths } from "@stryke/path/join";
5
+ import { kebabCase } from "@stryke/string-format/kebab-case";
6
+ import defu from "defu";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * A package containing a Powerlines plugin to configure infrastructure and deploy a project using Pulumi IaC.
11
+ *
12
+ * @see https://www.pulumi.com
13
+ *
14
+ * @param options - The Pulumi plugin user configuration options.
15
+ * @returns A Powerlines plugin to configure infrastructure and deploy a project using Pulumi.
16
+ */
17
+ const plugin = (options = {}) => {
18
+ return {
19
+ name: "pulumi",
20
+ async config() {
21
+ return { deploy: { pulumi: defu(options, {
22
+ projectName: this.config.name,
23
+ workDir: joinPaths(this.artifactsPath, "infrastructure"),
24
+ settings: {}
25
+ }) } };
26
+ },
27
+ async configResolved() {
28
+ if (!options.stack) this.config.deploy.pulumi.stackName ??= fullyQualifiedStackName(kebabCase(getOrganizationName(this) || "default"), `${getWorkspaceName(this) ? `${kebabCase(getWorkspaceName(this))}-` : ""}${kebabCase(this.config.name)}`, this.config.mode);
29
+ },
30
+ deploy: {
31
+ order: "post",
32
+ async handler() {
33
+ this.info(`Deploying Pulumi stack: ${this.config.deploy.pulumi.stack?.name || this.config.deploy.pulumi.stackName}`);
34
+ if (!options.stack && !options.program && !options.projectName || !options.workDir) throw new Error(`Pulumi plugin requires either an inline program or a working directory to be specified.`);
35
+ let stack = options.stack;
36
+ stack ??= await LocalWorkspace.createOrSelectStack(omit(this.config.deploy.pulumi, ["options", "settings"]));
37
+ if (this.config.deploy.pulumi.settings && Object.keys(this.config.deploy.pulumi.settings).length > 0) await stack.workspace.saveStackSettings(stack.name, this.config.deploy.pulumi.settings);
38
+ await stack.refresh({ onOutput: this.debug.bind(this) });
39
+ if (this.config.deploy.pulumi.destroy) await stack.destroy({ onOutput: this.debug.bind(this) });
40
+ const result = await stack.up({ onOutput: this.debug.bind(this) });
41
+ this.info(`Successfully deployed ${stack.name} (v${result.summary.version}): ${result.summary.message}`);
42
+ }
43
+ }
44
+ };
45
+ };
46
+ var src_default = plugin;
47
+
48
+ //#endregion
49
+ export { src_default as default, plugin };
@@ -1 +1,49 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-set-object`),n=require(`@stryke/type-checks/is-set-string`);function r(e){let r;return(0,t.isSetObject)(e.workspaceConfig.organization)&&(r=e.workspaceConfig.organization.name),!r&&(0,n.isSetString)(e.workspaceConfig.organization)&&(r=e.workspaceConfig.organization),!r&&Array.isArray(e.packageJson.maintainers)&&e.packageJson.maintainers.length>0&&((0,t.isSetObject)(e.packageJson.maintainers[0])&&(r=e.packageJson.maintainers[0].name),!r&&(0,n.isSetString)(e.packageJson.maintainers[0])&&(r=e.packageJson.maintainers[0])),!r&&Array.isArray(e.packageJson.author)&&e.packageJson.author.length>0&&((0,t.isSetObject)(e.packageJson.author[0])&&(r=e.packageJson.author[0].name),!r&&(0,n.isSetString)(e.packageJson.author[0])&&(r=e.packageJson.author[0])),!r&&Array.isArray(e.packageJson.contributors)&&e.packageJson.contributors.length>0&&((0,t.isSetObject)(e.packageJson.contributors[0])&&(r=e.packageJson.contributors[0].name),!r&&(0,n.isSetString)(e.packageJson.contributors[0])&&(r=e.packageJson.contributors[0])),!r&&(0,n.isSetString)(e.packageJson.namespace)&&(r=e.packageJson.namespace.replace(/^@/,``)),!r&&(0,n.isSetString)(e.packageJson.name)&&(r=e.packageJson.name.replace(/^@/,``).replace(/\/.*$/,``)),r}function i(e){let t;return(0,n.isSetString)(e.workspaceConfig.name)&&(t=e.workspaceConfig.name),!t&&(0,n.isSetString)(e.workspaceConfig.namespace)&&(t=e.workspaceConfig.namespace.replace(/^@/,``)),!t&&(0,n.isSetString)(e.packageJson.namespace)&&(t=e.packageJson.namespace.replace(/^@/,``)),!t&&(0,n.isSetString)(e.packageJson.name)&&(t=e.packageJson.name.replace(/^@/,``).replace(/\/.*$/,``)),t}exports.getOrganizationName=r,exports.getWorkspaceName=i;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
+
5
+ //#region ../powerlines/src/plugin-utils/context-helpers.ts
6
+ /**
7
+ * Get the organization name from the context
8
+ *
9
+ * @param context - The Powerlines plugin context.
10
+ * @returns The organization name or undefined if not found.
11
+ */
12
+ function getOrganizationName(context) {
13
+ let result;
14
+ if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization.name;
15
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.organization)) result = context.workspaceConfig.organization;
16
+ if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
17
+ if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
18
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
19
+ }
20
+ if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
21
+ if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.author[0])) result = context.packageJson.author[0].name;
22
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.author[0])) result = context.packageJson.author[0];
23
+ }
24
+ if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
25
+ if ((0, __stryke_type_checks_is_set_object.isSetObject)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0].name;
26
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.contributors[0])) result = context.packageJson.contributors[0];
27
+ }
28
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
29
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
30
+ return result;
31
+ }
32
+ /**
33
+ * Get the organization name from the context
34
+ *
35
+ * @param context - The Powerlines plugin context.
36
+ * @returns The organization name or undefined if not found.
37
+ */
38
+ function getWorkspaceName(context) {
39
+ let result;
40
+ if ((0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.name)) result = context.workspaceConfig.name;
41
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.workspaceConfig.namespace)) result = context.workspaceConfig.namespace.replace(/^@/, "");
42
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
43
+ if (!result && (0, __stryke_type_checks_is_set_string.isSetString)(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
44
+ return result;
45
+ }
46
+
47
+ //#endregion
48
+ exports.getOrganizationName = getOrganizationName;
49
+ exports.getWorkspaceName = getWorkspaceName;
@@ -1 +1,47 @@
1
- import{isSetObject as e}from"@stryke/type-checks/is-set-object";import{isSetString as t}from"@stryke/type-checks/is-set-string";function n(n){let r;return e(n.workspaceConfig.organization)&&(r=n.workspaceConfig.organization.name),!r&&t(n.workspaceConfig.organization)&&(r=n.workspaceConfig.organization),!r&&Array.isArray(n.packageJson.maintainers)&&n.packageJson.maintainers.length>0&&(e(n.packageJson.maintainers[0])&&(r=n.packageJson.maintainers[0].name),!r&&t(n.packageJson.maintainers[0])&&(r=n.packageJson.maintainers[0])),!r&&Array.isArray(n.packageJson.author)&&n.packageJson.author.length>0&&(e(n.packageJson.author[0])&&(r=n.packageJson.author[0].name),!r&&t(n.packageJson.author[0])&&(r=n.packageJson.author[0])),!r&&Array.isArray(n.packageJson.contributors)&&n.packageJson.contributors.length>0&&(e(n.packageJson.contributors[0])&&(r=n.packageJson.contributors[0].name),!r&&t(n.packageJson.contributors[0])&&(r=n.packageJson.contributors[0])),!r&&t(n.packageJson.namespace)&&(r=n.packageJson.namespace.replace(/^@/,``)),!r&&t(n.packageJson.name)&&(r=n.packageJson.name.replace(/^@/,``).replace(/\/.*$/,``)),r}function r(e){let n;return t(e.workspaceConfig.name)&&(n=e.workspaceConfig.name),!n&&t(e.workspaceConfig.namespace)&&(n=e.workspaceConfig.namespace.replace(/^@/,``)),!n&&t(e.packageJson.namespace)&&(n=e.packageJson.namespace.replace(/^@/,``)),!n&&t(e.packageJson.name)&&(n=e.packageJson.name.replace(/^@/,``).replace(/\/.*$/,``)),n}export{n as getOrganizationName,r as getWorkspaceName};
1
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
+
4
+ //#region ../powerlines/src/plugin-utils/context-helpers.ts
5
+ /**
6
+ * Get the organization name from the context
7
+ *
8
+ * @param context - The Powerlines plugin context.
9
+ * @returns The organization name or undefined if not found.
10
+ */
11
+ function getOrganizationName(context) {
12
+ let result;
13
+ if (isSetObject(context.workspaceConfig.organization)) result = context.workspaceConfig.organization.name;
14
+ if (!result && isSetString(context.workspaceConfig.organization)) result = context.workspaceConfig.organization;
15
+ if (!result && Array.isArray(context.packageJson.maintainers) && context.packageJson.maintainers.length > 0) {
16
+ if (isSetObject(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0].name;
17
+ if (!result && isSetString(context.packageJson.maintainers[0])) result = context.packageJson.maintainers[0];
18
+ }
19
+ if (!result && Array.isArray(context.packageJson.author) && context.packageJson.author.length > 0) {
20
+ if (isSetObject(context.packageJson.author[0])) result = context.packageJson.author[0].name;
21
+ if (!result && isSetString(context.packageJson.author[0])) result = context.packageJson.author[0];
22
+ }
23
+ if (!result && Array.isArray(context.packageJson.contributors) && context.packageJson.contributors.length > 0) {
24
+ if (isSetObject(context.packageJson.contributors[0])) result = context.packageJson.contributors[0].name;
25
+ if (!result && isSetString(context.packageJson.contributors[0])) result = context.packageJson.contributors[0];
26
+ }
27
+ if (!result && isSetString(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
28
+ if (!result && isSetString(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
29
+ return result;
30
+ }
31
+ /**
32
+ * Get the organization name from the context
33
+ *
34
+ * @param context - The Powerlines plugin context.
35
+ * @returns The organization name or undefined if not found.
36
+ */
37
+ function getWorkspaceName(context) {
38
+ let result;
39
+ if (isSetString(context.workspaceConfig.name)) result = context.workspaceConfig.name;
40
+ if (!result && isSetString(context.workspaceConfig.namespace)) result = context.workspaceConfig.namespace.replace(/^@/, "");
41
+ if (!result && isSetString(context.packageJson.namespace)) result = context.packageJson.namespace.replace(/^@/, "");
42
+ if (!result && isSetString(context.packageJson.name)) result = context.packageJson.name.replace(/^@/, "").replace(/\/.*$/, "");
43
+ return result;
44
+ }
45
+
46
+ //#endregion
47
+ export { getOrganizationName, getWorkspaceName };
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-pulumi",
3
- "version": "0.2.97",
3
+ "version": "0.2.98",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to transform source code to be platform agnostic using pulumi.",
6
6
  "repository": {
@@ -117,21 +117,21 @@
117
117
  "files": ["dist/**/*"],
118
118
  "keywords": ["pulumi", "powerlines", "storm-software", "powerlines-plugin"],
119
119
  "dependencies": {
120
- "@stryke/type-checks": "^0.5.14",
121
- "@stryke/path": "^0.24.0",
122
- "@stryke/fs": "^0.33.26",
123
- "@stryke/helpers": "^0.9.31",
124
- "@stryke/types": "^0.10.28",
125
- "@stryke/string-format": "^0.12.29",
120
+ "@stryke/type-checks": "^0.5.15",
121
+ "@stryke/path": "^0.24.1",
122
+ "@stryke/fs": "^0.33.27",
123
+ "@stryke/helpers": "^0.9.32",
124
+ "@stryke/types": "^0.10.29",
125
+ "@stryke/string-format": "^0.12.30",
126
126
  "@pulumi/pulumi": "^3.214.0",
127
127
  "defu": "^6.1.4",
128
- "powerlines": "^0.36.22",
128
+ "powerlines": "^0.36.23",
129
129
  "typescript": "^5.9.3"
130
130
  },
131
131
  "devDependencies": {
132
- "@powerlines/nx": "^0.11.48",
132
+ "@powerlines/nx": "^0.11.49",
133
133
  "@types/node": "^24.10.4"
134
134
  },
135
135
  "publishConfig": { "access": "public" },
136
- "gitHead": "f88fe8eb30f96536b83fc9af884972d48e31e63a"
136
+ "gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
137
137
  }