@powerlines/plugin-alloy 0.26.268 → 0.26.270

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.
@@ -19,11 +19,10 @@ var __copyProps = (to, from, except, desc) => {
19
19
  }
20
20
  return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
23
  value: mod,
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
-
29
28
  exports.__toESM = __toESM;
@@ -28,7 +28,8 @@ function InfrastructureFile(props) {
28
28
  const context = require_core_contexts_context.usePowerlinesSafe();
29
29
  const filetype = (0, _alloy_js_core.computed)(() => _filetype || extension?.replace(/^\.*/, "") || ((0, _stryke_path_file_path_fns.hasFileExtension)(id) ? (0, _stryke_path_file_path_fns.findFileExtensionSafe)(id) : ""));
30
30
  const path = (0, _alloy_js_core.computed)(() => {
31
- return (0, _stryke_path_append.appendExtension)((0, _stryke_path_replace.replaceExtension)(context ? (0, _stryke_path_append.appendPath)(id, (0, _stryke_path_replace.replacePath)(context.infrastructurePath, context.config.cwd)) : id), filetype.value);
31
+ const value = context ? (0, _stryke_path_append.appendPath)(id, (0, _stryke_path_replace.replacePath)(context.infrastructurePath, context.config.cwd)) : id;
32
+ return (0, _stryke_path_append.appendExtension)((0, _stryke_path_replace.replaceExtension)(value), filetype.value);
32
33
  });
33
34
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_source_file.SourceFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
34
35
  get filetype() {
@@ -38,10 +39,10 @@ function InfrastructureFile(props) {
38
39
  return path.value;
39
40
  },
40
41
  get meta() {
41
- return (0, defu.default)({
42
+ return (0, defu.default)({ data: {
42
43
  kind: "infrastructure",
43
44
  id: (0, _stryke_path_replace.replaceExtension)(id)
44
- }, meta ?? {});
45
+ } }, meta ?? {});
45
46
  },
46
47
  children
47
48
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-file.d.cts","names":[],"sources":["../../../src/core/components/infrastructure-file.tsx"],"mappings":";;KAgCY,0BAA0B,KAAK;;;;EAIzC;;;;;;;EAQA;;;;;;;;iBASc,mBAAmB,OAAO,mDAAuB"}
1
+ {"version":3,"file":"infrastructure-file.d.cts","names":[],"sources":["../../../src/core/components/infrastructure-file.tsx"],"mappings":";;KA8BY,0BAA0B,KAAK;;;;EAIzC;;;;;;;EAQA;;;;;;;;iBASc,mBAAmB,OAAO,mDAAuB"}
@@ -25,7 +25,8 @@ function InfrastructureFile(props) {
25
25
  const context = usePowerlinesSafe();
26
26
  const filetype = computed(() => _filetype || extension?.replace(/^\.*/, "") || (hasFileExtension(id) ? findFileExtensionSafe(id) : ""));
27
27
  const path = computed(() => {
28
- return appendExtension(replaceExtension(context ? appendPath(id, replacePath(context.infrastructurePath, context.config.cwd)) : id), filetype.value);
28
+ const value = context ? appendPath(id, replacePath(context.infrastructurePath, context.config.cwd)) : id;
29
+ return appendExtension(replaceExtension(value), filetype.value);
29
30
  });
30
31
  return createComponent(SourceFile, mergeProps(rest, {
31
32
  get filetype() {
@@ -35,10 +36,10 @@ function InfrastructureFile(props) {
35
36
  return path.value;
36
37
  },
37
38
  get meta() {
38
- return defu({
39
+ return defu({ data: {
39
40
  kind: "infrastructure",
40
41
  id: replaceExtension(id)
41
- }, meta ?? {});
42
+ } }, meta ?? {});
42
43
  },
43
44
  children
44
45
  }));
@@ -108,7 +108,7 @@ function getCapnpUnionTypes(schema) {
108
108
  function isCapnpStringUnion(schema) {
109
109
  return getCapnpUnionTypes(schema).some((member) => (0, _power_plant_schema.isJsonSchemaString)(member) || (0, _power_plant_schema.isJsonSchemaLiteral)(member) && (0, _stryke_type_checks_is_string.isString)(member.const));
110
110
  }
111
- const LARGE_BUFFER = 1024 * 1e6;
111
+ const LARGE_BUFFER = 1024e6;
112
112
  const execAsync = (0, node_util.promisify)(node_child_process.exec);
113
113
  async function generateCapnpId() {
114
114
  const { stdout } = await execAsync("capnp id", {
@@ -105,7 +105,7 @@ function getCapnpUnionTypes(schema) {
105
105
  function isCapnpStringUnion(schema) {
106
106
  return getCapnpUnionTypes(schema).some((member) => isJsonSchemaString(member) || isJsonSchemaLiteral(member) && isString(member.const));
107
107
  }
108
- const LARGE_BUFFER = 1024 * 1e6;
108
+ const LARGE_BUFFER = 1024e6;
109
109
  const execAsync = promisify(exec);
110
110
  async function generateCapnpId() {
111
111
  const { stdout } = await execAsync("capnp id", {
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
3
+
4
+ //#region src/helpers/prefix.ts
5
+ function getPrefix(context) {
6
+ return (0, _stryke_string_format_kebab_case.kebabCase)(context?.config.framework?.name) || "powerlines";
7
+ }
8
+
9
+ //#endregion
10
+ exports.getPrefix = getPrefix;
@@ -0,0 +1,6 @@
1
+ import { Context } from "powerlines";
2
+ //#region src/helpers/prefix.d.ts
3
+ declare function getPrefix(context?: Context): string;
4
+ //#endregion
5
+ export { getPrefix };
6
+ //# sourceMappingURL=prefix.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.d.cts","names":[],"sources":["../../src/helpers/prefix.ts"],"mappings":";;iBAqBgB,UAAU,UAAU"}
@@ -0,0 +1,6 @@
1
+ import { Context } from "powerlines";
2
+ //#region src/helpers/prefix.d.ts
3
+ declare function getPrefix(context?: Context): string;
4
+ //#endregion
5
+ export { getPrefix };
6
+ //# sourceMappingURL=prefix.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.d.mts","names":[],"sources":["../../src/helpers/prefix.ts"],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { kebabCase } from "@stryke/string-format/kebab-case";
2
+
3
+ //#region src/helpers/prefix.ts
4
+ function getPrefix(context) {
5
+ return kebabCase(context?.config.framework?.name) || "powerlines";
6
+ }
7
+
8
+ //#endregion
9
+ export { getPrefix };
10
+ //# sourceMappingURL=prefix.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.mjs","names":[],"sources":[],"mappings":""}
package/dist/render.cjs CHANGED
@@ -34,7 +34,7 @@ function getDocumentContents(document) {
34
34
  * @param spec - The spec to use for the render.
35
35
  * @returns A promise that resolves when rendering is complete.
36
36
  */
37
- async function render(context, template, spec) {
37
+ async function render(context, template, spec = {}) {
38
38
  const documents = await (0, _power_plant_alloy_js_generate.generate)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_context.PowerlinesContext.Provider, {
39
39
  value: context,
40
40
  children: template
@@ -56,28 +56,28 @@ async function render(context, template, spec) {
56
56
  }
57
57
  context.debug(`Emitting ${entries.length} output files from Alloy-js components: ${(0, _stryke_string_format_list.list)(entries.map((document) => {
58
58
  const metadata = getDocumentMeta(document);
59
- return `${(0, _stryke_path_replace.replacePath)(document.path, context.config.cwd)}${metadata.kind === "builtin" || metadata.kind === "infrastructure" ? ` (${metadata.kind === "builtin" ? "Builtin" : "Infrastructure"})` : ""}`;
59
+ return `${(0, _stryke_path_replace.replacePath)(document.path, context.config.cwd)}${metadata.data?.kind === "builtin" || metadata.data?.kind === "infrastructure" ? ` (${metadata.data?.kind === "builtin" ? "Builtin" : "Infrastructure"})` : ""}`;
60
60
  }))}.`);
61
61
  for (const document of entries) {
62
62
  const metadata = getDocumentMeta(document);
63
63
  const contents = getDocumentContents(document);
64
- if (metadata.kind === "builtin") {
65
- if (!metadata.id) throw new Error(`Built-in file "${document.path}" is missing its ID in the render metadata.`);
66
- context.emitBuiltinSync(contents, metadata.id, {
67
- skipFormat: metadata.skipFormat,
68
- storage: metadata.storage,
64
+ if (metadata.data?.kind === "builtin") {
65
+ if (!metadata.data?.id) throw new Error(`Built-in file "${document.path}" is missing its ID in the render metadata.`);
66
+ context.emitBuiltinSync(contents, metadata.data?.id, {
67
+ skipFormat: metadata.data?.skipFormat,
68
+ storage: metadata.data?.storage,
69
69
  extension: (0, _stryke_path_file_path_fns.findFileExtension)(document.path)
70
70
  });
71
- } else if (metadata.kind === "entry") context.emitEntrySync(contents, document.path, {
72
- skipFormat: metadata.skipFormat,
73
- storage: metadata.storage,
74
- ...metadata.typeDefinition ?? {}
71
+ } else if (metadata.data?.kind === "entry") context.emitEntrySync(contents, document.path, {
72
+ skipFormat: metadata.data?.skipFormat,
73
+ storage: metadata.data?.storage,
74
+ ...metadata.data?.typeDefinition ?? {}
75
75
  });
76
- else if (metadata.kind === "infrastructure") {
77
- if (!metadata.id) throw new Error(`Infrastructure file "${document.path}" is missing its ID in the render metadata.`);
78
- context.emitInfrastructureSync(contents, metadata.id, {
79
- skipFormat: metadata.skipFormat,
80
- storage: metadata.storage,
76
+ else if (metadata.data?.kind === "infrastructure") {
77
+ if (!metadata.data?.id) throw new Error(`Infrastructure file "${document.path}" is missing its ID in the render metadata.`);
78
+ context.emitInfrastructureSync(contents, metadata.data?.id, {
79
+ skipFormat: metadata.data?.skipFormat,
80
+ storage: metadata.data?.storage,
81
81
  extension: (0, _stryke_path_file_path_fns.findFileExtension)(document.path)
82
82
  });
83
83
  } else context.emitSync(contents, document.path, metadata);
@@ -99,7 +99,7 @@ async function render(context, template, spec) {
99
99
  * @returns The rendered output as a string.
100
100
  */
101
101
  function renderString(context, children, options) {
102
- return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_context.PowerlinesContext.Provider, {
102
+ const tree = (0, _alloy_js_core.renderTree)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_context.PowerlinesContext.Provider, {
103
103
  value: context,
104
104
  get children() {
105
105
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Output, {
@@ -109,7 +109,8 @@ function renderString(context, children, options) {
109
109
  children
110
110
  });
111
111
  }
112
- })), options);
112
+ }));
113
+ return (0, _alloy_js_core.printTree)(tree, options);
113
114
  }
114
115
 
115
116
  //#endregion
package/dist/render.d.cts CHANGED
@@ -45,7 +45,7 @@ interface MetaItem extends MetaConfig {
45
45
  * @param spec - The spec to use for the render.
46
46
  * @returns A promise that resolves when rendering is complete.
47
47
  */
48
- declare function render<TContext extends PluginContext, TSpec = any>(context: TContext, template: Children, spec: TSpec): Promise<void>;
48
+ declare function render<TContext extends PluginContext, TSpec = any>(context: TContext, template: Children, spec?: TSpec): Promise<void>;
49
49
  /**
50
50
  * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.
51
51
  *
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.cts","names":[],"sources":["../src/render.tsx"],"mappings":";;;;UA4BiB,iBAAiB;;;;EAIhC;;;;EAKA;;;;EAKA,UAAU;;;;EAKV;;;;EAKA,iBAAiB;GAEhB;;;;;;;;;;;;;;;;;;;;;;iBA+BmB,OAAO,iBAAiB,eAAe,aAC3D,SAAS,UACT,UAAU,UACV,MAAM,QAAK;;;;;;;;;;;;;;;;iBAmGG,aAAa,iBAAiB,eAC5C,SAAS,UACT,UAAU,UACV,UAAU"}
1
+ {"version":3,"file":"render.d.cts","names":[],"sources":["../src/render.tsx"],"mappings":";;;;UA4BiB,iBAAiB;;;;EAIhC;;;;EAKA;;;;EAKA,UAAU;;;;EAKV;;;;EAKA,iBAAiB;GAEhB;;;;;;;;;;;;;;;;;;;;;;iBA+BmB,OAAO,iBAAiB,eAAe,aAC3D,SAAS,UACT,UAAU,UACV,OAAM,QAAmB;;;;;;;;;;;;;;;;iBAoGX,aAAa,iBAAiB,eAC5C,SAAS,UACT,UAAU,UACV,UAAU"}
package/dist/render.d.mts CHANGED
@@ -45,7 +45,7 @@ interface MetaItem extends MetaConfig {
45
45
  * @param spec - The spec to use for the render.
46
46
  * @returns A promise that resolves when rendering is complete.
47
47
  */
48
- declare function render<TContext extends PluginContext, TSpec = any>(context: TContext, template: Children, spec: TSpec): Promise<void>;
48
+ declare function render<TContext extends PluginContext, TSpec = any>(context: TContext, template: Children, spec?: TSpec): Promise<void>;
49
49
  /**
50
50
  * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.
51
51
  *
package/dist/render.mjs CHANGED
@@ -33,7 +33,7 @@ function getDocumentContents(document) {
33
33
  * @param spec - The spec to use for the render.
34
34
  * @returns A promise that resolves when rendering is complete.
35
35
  */
36
- async function render(context, template, spec) {
36
+ async function render(context, template, spec = {}) {
37
37
  const documents = await generate(createComponent(PowerlinesContext.Provider, {
38
38
  value: context,
39
39
  children: template
@@ -55,28 +55,28 @@ async function render(context, template, spec) {
55
55
  }
56
56
  context.debug(`Emitting ${entries.length} output files from Alloy-js components: ${list(entries.map((document) => {
57
57
  const metadata = getDocumentMeta(document);
58
- return `${replacePath(document.path, context.config.cwd)}${metadata.kind === "builtin" || metadata.kind === "infrastructure" ? ` (${metadata.kind === "builtin" ? "Builtin" : "Infrastructure"})` : ""}`;
58
+ return `${replacePath(document.path, context.config.cwd)}${metadata.data?.kind === "builtin" || metadata.data?.kind === "infrastructure" ? ` (${metadata.data?.kind === "builtin" ? "Builtin" : "Infrastructure"})` : ""}`;
59
59
  }))}.`);
60
60
  for (const document of entries) {
61
61
  const metadata = getDocumentMeta(document);
62
62
  const contents = getDocumentContents(document);
63
- if (metadata.kind === "builtin") {
64
- if (!metadata.id) throw new Error(`Built-in file "${document.path}" is missing its ID in the render metadata.`);
65
- context.emitBuiltinSync(contents, metadata.id, {
66
- skipFormat: metadata.skipFormat,
67
- storage: metadata.storage,
63
+ if (metadata.data?.kind === "builtin") {
64
+ if (!metadata.data?.id) throw new Error(`Built-in file "${document.path}" is missing its ID in the render metadata.`);
65
+ context.emitBuiltinSync(contents, metadata.data?.id, {
66
+ skipFormat: metadata.data?.skipFormat,
67
+ storage: metadata.data?.storage,
68
68
  extension: findFileExtension(document.path)
69
69
  });
70
- } else if (metadata.kind === "entry") context.emitEntrySync(contents, document.path, {
71
- skipFormat: metadata.skipFormat,
72
- storage: metadata.storage,
73
- ...metadata.typeDefinition ?? {}
70
+ } else if (metadata.data?.kind === "entry") context.emitEntrySync(contents, document.path, {
71
+ skipFormat: metadata.data?.skipFormat,
72
+ storage: metadata.data?.storage,
73
+ ...metadata.data?.typeDefinition ?? {}
74
74
  });
75
- else if (metadata.kind === "infrastructure") {
76
- if (!metadata.id) throw new Error(`Infrastructure file "${document.path}" is missing its ID in the render metadata.`);
77
- context.emitInfrastructureSync(contents, metadata.id, {
78
- skipFormat: metadata.skipFormat,
79
- storage: metadata.storage,
75
+ else if (metadata.data?.kind === "infrastructure") {
76
+ if (!metadata.data?.id) throw new Error(`Infrastructure file "${document.path}" is missing its ID in the render metadata.`);
77
+ context.emitInfrastructureSync(contents, metadata.data?.id, {
78
+ skipFormat: metadata.data?.skipFormat,
79
+ storage: metadata.data?.storage,
80
80
  extension: findFileExtension(document.path)
81
81
  });
82
82
  } else context.emitSync(contents, document.path, metadata);
@@ -98,7 +98,7 @@ async function render(context, template, spec) {
98
98
  * @returns The rendered output as a string.
99
99
  */
100
100
  function renderString(context, children, options) {
101
- return printTree(renderTree(createComponent(PowerlinesContext.Provider, {
101
+ const tree = renderTree(createComponent(PowerlinesContext.Provider, {
102
102
  value: context,
103
103
  get children() {
104
104
  return createComponent(Output, {
@@ -108,7 +108,8 @@ function renderString(context, children, options) {
108
108
  children
109
109
  });
110
110
  }
111
- })), options);
111
+ }));
112
+ return printTree(tree, options);
112
113
  }
113
114
 
114
115
  //#endregion
@@ -4,8 +4,9 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
4
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let _alloy_js_core = require("@alloy-js/core");
6
6
  let _stryke_path_replace = require("@stryke/path/replace");
7
- let _power_plant_alloy_js_typescript_components_typescript_file = require("@power-plant/alloy-js/typescript/components/typescript-file");
7
+ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
8
8
  let _power_plant_alloy_js_typescript_components_tsdoc = require("@power-plant/alloy-js/typescript/components/tsdoc");
9
+ let _power_plant_alloy_js_typescript_components_typescript_file = require("@power-plant/alloy-js/typescript/components/typescript-file");
9
10
  let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
10
11
 
11
12
  //#region src/typescript/components/builtin-file.tsx
@@ -28,6 +29,9 @@ function BuiltinFile(props) {
28
29
  const context = require_core_contexts_context.usePowerlinesSafe();
29
30
  const path = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replacePath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? id : (0, _stryke_path_replace.replaceExtension)(id)}${(0, _stryke_path_file_path_fns.hasFileExtension)(id) && !(0, _stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
30
31
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
32
+ get prefix() {
33
+ return (0, _stryke_string_format_kebab_case.kebabCase)(context?.config.framework?.name) || "powerlines";
34
+ },
31
35
  get header() {
32
36
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_typescript_file.TypescriptFileHeader, {
33
37
  get header() {
@@ -45,12 +49,12 @@ function BuiltinFile(props) {
45
49
  });
46
50
  },
47
51
  get meta() {
48
- return {
52
+ return { data: {
49
53
  kind: "builtin",
50
54
  extension: tsx ? "tsx" : "ts",
51
55
  id: (0, _stryke_path_replace.replaceExtension)(id),
52
56
  internal
53
- };
57
+ } };
54
58
  }
55
59
  }, rest, {
56
60
  get path() {
@@ -1,5 +1,5 @@
1
- import { TypescriptFileProps } from "@power-plant/alloy-js/typescript/components/typescript-file";
2
1
  import { TSDocModuleProps } from "@power-plant/alloy-js/typescript/components/tsdoc";
2
+ import { TypescriptFileProps } from "@power-plant/alloy-js/typescript/components/typescript-file";
3
3
  //#region src/typescript/components/builtin-file.d.ts
4
4
  type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-file.d.cts","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"mappings":";;;KAkCY,mBAAmB,KAAK,+BAClC,KAAK;;;;;;;EAOH;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;;;iBASY,YAAY,OAAO,4CAAgB"}
1
+ {"version":3,"file":"builtin-file.d.cts","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"mappings":";;;KAiCY,mBAAmB,KAAK,+BAClC,KAAK;;;;;;;EAOH;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;;;iBASY,YAAY,OAAO,4CAAgB"}
@@ -1,5 +1,5 @@
1
- import { TypescriptFileProps } from "@power-plant/alloy-js/typescript/components/typescript-file";
2
1
  import { TSDocModuleProps } from "@power-plant/alloy-js/typescript/components/tsdoc";
2
+ import { TypescriptFileProps } from "@power-plant/alloy-js/typescript/components/typescript-file";
3
3
  //#region src/typescript/components/builtin-file.d.ts
4
4
  type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
5
5
  /**
@@ -3,8 +3,9 @@ import { hasFileExtension } from "@stryke/path/file-path-fns";
3
3
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
4
4
  import { computed, splitProps } from "@alloy-js/core";
5
5
  import { replaceExtension, replacePath } from "@stryke/path/replace";
6
- import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "@power-plant/alloy-js/typescript/components/typescript-file";
6
+ import { kebabCase } from "@stryke/string-format/kebab-case";
7
7
  import { TSDocModule } from "@power-plant/alloy-js/typescript/components/tsdoc";
8
+ import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "@power-plant/alloy-js/typescript/components/typescript-file";
8
9
  import { isSet } from "@stryke/type-checks/is-set";
9
10
 
10
11
  //#region src/typescript/components/builtin-file.tsx
@@ -27,6 +28,9 @@ function BuiltinFile(props) {
27
28
  const context = usePowerlinesSafe();
28
29
  const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
29
30
  return createComponent(TypescriptFile, mergeProps({
31
+ get prefix() {
32
+ return kebabCase(context?.config.framework?.name) || "powerlines";
33
+ },
30
34
  get header() {
31
35
  return createComponent(TypescriptFileHeader, {
32
36
  get header() {
@@ -44,12 +48,12 @@ function BuiltinFile(props) {
44
48
  });
45
49
  },
46
50
  get meta() {
47
- return {
51
+ return { data: {
48
52
  kind: "builtin",
49
53
  extension: tsx ? "tsx" : "ts",
50
54
  id: replaceExtension(id),
51
55
  internal
52
- };
56
+ } };
53
57
  }
54
58
  }, rest, {
55
59
  get path() {
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_core_contexts_context = require('../../core/contexts/context.cjs');
4
+ const require_helpers_prefix = require('../../helpers/prefix.cjs');
4
5
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
5
6
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
7
  let _alloy_js_core = require("@alloy-js/core");
@@ -28,12 +29,14 @@ function EntryFile(props) {
28
29
  ]);
29
30
  const context = require_core_contexts_context.usePowerlinesSafe();
30
31
  const fullPath = (0, _alloy_js_core.computed)(() => context ? (0, _stryke_path_append.appendPath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? path : (0, _stryke_path_replace.replaceExtension)(path)}${tsx ? ".tsx" : (0, _stryke_path_file_path_fns.hasFileExtension)(path) ? "" : ".ts"}`, (0, _stryke_path_replace.replacePath)(context.entryPath, context.config.cwd)) : path);
31
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
32
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get prefix() {
33
+ return require_helpers_prefix.getPrefix(context);
34
+ } }, rest, {
32
35
  get path() {
33
36
  return fullPath.value;
34
37
  },
35
38
  get meta() {
36
- return (0, defu.default)({ kind: "entry" }, meta ?? {}, { typeDefinition });
39
+ return (0, defu.default)({ data: { kind: "entry" } }, meta ?? {}, { data: { typeDefinition } });
37
40
  },
38
41
  children
39
42
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"entry-file.d.cts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;KA+BY,iBAAiB;;;;;;EAM3B;;;;EAKA,iBAAiB;;;;;;;;iBASH,UAAU,OAAO,0CAAc"}
1
+ {"version":3,"file":"entry-file.d.cts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;KA8BY,iBAAiB;;;;;;EAM3B;;;;EAKA,iBAAiB;;;;;;;;iBASH,UAAU,OAAO,0CAAc"}
@@ -1,4 +1,5 @@
1
1
  import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
+ import { getPrefix } from "../../helpers/prefix.mjs";
2
3
  import { hasFileExtension } from "@stryke/path/file-path-fns";
3
4
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
4
5
  import { computed, splitProps } from "@alloy-js/core";
@@ -25,12 +26,14 @@ function EntryFile(props) {
25
26
  ]);
26
27
  const context = usePowerlinesSafe();
27
28
  const fullPath = computed(() => context ? appendPath(`${!isSet(tsx) ? path : replaceExtension(path)}${tsx ? ".tsx" : hasFileExtension(path) ? "" : ".ts"}`, replacePath(context.entryPath, context.config.cwd)) : path);
28
- return createComponent(TypescriptFile, mergeProps(rest, {
29
+ return createComponent(TypescriptFile, mergeProps({ get prefix() {
30
+ return getPrefix(context);
31
+ } }, rest, {
29
32
  get path() {
30
33
  return fullPath.value;
31
34
  },
32
35
  get meta() {
33
- return defu({ kind: "entry" }, meta ?? {}, { typeDefinition });
36
+ return defu({ data: { kind: "entry" } }, meta ?? {}, { data: { typeDefinition } });
34
37
  },
35
38
  children
36
39
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.26.268",
3
+ "version": "0.26.270",
4
4
  "description": "A Powerlines plugin to generate project code using Alloy JS via Power Plant.",
5
5
  "keywords": ["alloy-js", "powerlines", "powerlines-plugin"],
6
6
  "homepage": "https://stormsoftware.com",
@@ -165,6 +165,20 @@
165
165
  "default": "./dist/helpers/create-builtin.mjs"
166
166
  }
167
167
  },
168
+ "./helpers/prefix": {
169
+ "require": {
170
+ "types": "./dist/helpers/prefix.d.cts",
171
+ "default": "./dist/helpers/prefix.cjs"
172
+ },
173
+ "import": {
174
+ "types": "./dist/helpers/prefix.d.mts",
175
+ "default": "./dist/helpers/prefix.mjs"
176
+ },
177
+ "default": {
178
+ "types": "./dist/helpers/prefix.d.mts",
179
+ "default": "./dist/helpers/prefix.mjs"
180
+ }
181
+ },
168
182
  "./helpers/refkey": {
169
183
  "require": {
170
184
  "types": "./dist/helpers/refkey.d.cts",
@@ -288,11 +302,11 @@
288
302
  "@alloy-js/core": "^0.24.1",
289
303
  "@alloy-js/typescript": "^0.24.0",
290
304
  "@babel/preset-typescript": "^8.0.1",
291
- "@power-plant/alloy-js": "^0.0.50",
292
- "@power-plant/core": "^0.0.53",
293
- "@power-plant/schema": "^0.0.51",
294
- "@powerlines/plugin-babel": "^0.13.170",
295
- "@powerlines/plugin-power-plant": "^0.1.29",
305
+ "@power-plant/alloy-js": "^0.0.51",
306
+ "@power-plant/core": "^0.0.54",
307
+ "@power-plant/schema": "^0.0.52",
308
+ "@powerlines/plugin-babel": "0.13.172",
309
+ "@powerlines/plugin-power-plant": "0.1.31",
296
310
  "@storm-software/config-tools": "^1.190.109",
297
311
  "@stryke/capnp": "^0.12.125",
298
312
  "@stryke/convert": "^0.7.29",
@@ -302,15 +316,15 @@
302
316
  "@stryke/string-format": "^0.17.40",
303
317
  "@stryke/type-checks": "^0.6.31",
304
318
  "defu": "^6.1.7",
305
- "powerlines": "^0.47.173"
319
+ "powerlines": "0.47.175"
306
320
  },
307
321
  "devDependencies": {
308
322
  "@alloy-js/babel-preset": "^0.3.0",
309
- "@powerlines/plugin-plugin": "^0.12.585",
323
+ "@powerlines/plugin-plugin": "0.12.587",
310
324
  "@types/node": "^25.9.5"
311
325
  },
312
326
  "peerDependencies": { "@alloy-js/babel-preset": ">=0.3.0" },
313
327
  "peerDependenciesMeta": { "@alloy-js/babel-preset": { "optional": false } },
314
328
  "publishConfig": { "access": "public" },
315
- "gitHead": "c545208aff23181510bfb9676e1bedc7e32ed502"
329
+ "gitHead": "f81b909479c2bb719fb63c1c3a94763fa5b737f2"
316
330
  }