@powerlines/plugin-alloy 0.19.6 → 0.19.7
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/core/components/output.d.cts +3 -3
- package/dist/core/components/output.d.mts +1 -1
- package/dist/core/components/source-file.d.cts +3 -3
- package/dist/core/components/source-file.d.mts +1 -1
- package/dist/core/contexts/context.d.cts +2 -2
- package/dist/core/contexts/context.d.mts +2 -2
- package/dist/helpers/capnp.cjs +2 -2
- package/dist/helpers/capnp.d.cts +1 -1
- package/dist/helpers/capnp.d.mts +1 -1
- package/dist/helpers/capnp.mjs +1 -1
- package/dist/index.cjs +69 -78
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +69 -77
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/packages/powerlines/src/internal/helpers/hooks.d.mts +47 -0
- package/dist/packages/powerlines/src/lib/utilities/file-header.cjs +13 -0
- package/dist/packages/powerlines/src/lib/utilities/file-header.mjs +12 -0
- package/dist/packages/powerlines/src/types/api.d.mts +104 -0
- package/dist/packages/powerlines/src/types/build.d.mts +185 -0
- package/dist/packages/powerlines/src/types/commands.d.mts +8 -0
- package/dist/packages/powerlines/src/types/config.d.mts +424 -0
- package/dist/packages/powerlines/src/types/context.d.mts +514 -0
- package/dist/packages/powerlines/src/types/fs.d.mts +486 -0
- package/dist/packages/powerlines/src/types/hooks.d.mts +32 -0
- package/dist/packages/powerlines/src/types/plugin.d.mts +205 -0
- package/dist/packages/powerlines/src/types/resolved.d.mts +93 -0
- package/dist/packages/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/packages/powerlines/src/types/unplugin.d.mts +22 -0
- package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
- package/dist/powerlines/src/types/api.d.cts +104 -0
- package/dist/powerlines/src/types/build.d.cts +185 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/config.d.cts +424 -0
- package/dist/powerlines/src/types/context.d.cts +514 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/hooks.d.cts +32 -0
- package/dist/powerlines/src/types/plugin.d.cts +205 -0
- package/dist/powerlines/src/types/resolved.d.cts +93 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/unplugin.d.cts +22 -0
- package/dist/types/components.d.cts +2 -2
- package/dist/types/components.d.mts +2 -2
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.mts +1 -1
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +3 -3
- package/dist/typescript/components/entry-file.d.mts +3 -3
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/typescript-interface.d.cts +3 -3
- package/dist/typescript/components/typescript-interface.d.mts +3 -3
- package/dist/typescript/components/typescript-object.d.cts +3 -3
- package/dist/typescript/components/typescript-object.d.mts +3 -3
- package/package.json +7 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { PluginContext } from "../../powerlines/src/types/context.cjs";
|
|
1
2
|
import { MetaItem } from "../contexts/context.cjs";
|
|
2
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
4
|
import { OutputProps as OutputProps$1 } from "@alloy-js/core";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/output.d.ts
|
|
7
7
|
interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
|
|
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
|
|
|
17
17
|
/**
|
|
18
18
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
19
19
|
*/
|
|
20
|
-
declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>):
|
|
20
|
+
declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core1.Children;
|
|
21
21
|
declare type __ΩOutputProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { Output, OutputProps, __ΩOutputProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { PluginContext } from "../../packages/powerlines/src/types/context.mjs";
|
|
1
2
|
import { MetaItem } from "../contexts/context.mjs";
|
|
2
3
|
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
4
|
import { OutputProps as OutputProps$1 } from "@alloy-js/core";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/output.d.ts
|
|
7
7
|
interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { StoragePreset } from "../../powerlines/src/types/fs.cjs";
|
|
1
2
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
4
|
import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
|
|
4
|
-
import { StoragePreset } from "powerlines/types/fs";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/source-file.d.ts
|
|
7
7
|
type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
@@ -26,7 +26,7 @@ type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
|
26
26
|
* @param props - The properties for the source file.
|
|
27
27
|
* @returns The rendered source file component.
|
|
28
28
|
*/
|
|
29
|
-
declare function SourceFile(props: SourceFileProps):
|
|
29
|
+
declare function SourceFile(props: SourceFileProps): _alloy_js_core0.Children;
|
|
30
30
|
declare type __ΩSourceFileProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SourceFile, SourceFileProps, __ΩSourceFileProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { StoragePreset } from "../../packages/powerlines/src/types/fs.mjs";
|
|
1
2
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
3
|
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
4
|
import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
|
|
4
|
-
import { StoragePreset } from "powerlines/types/fs";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/source-file.d.ts
|
|
7
7
|
type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { StoragePreset } from "../../powerlines/src/types/fs.cjs";
|
|
2
|
+
import { PluginContext } from "../../powerlines/src/types/context.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/contexts/context.d.ts
|
|
5
5
|
interface MetaItem {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { StoragePreset } from "../../packages/powerlines/src/types/fs.mjs";
|
|
2
|
+
import { PluginContext } from "../../packages/powerlines/src/types/context.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/contexts/context.d.ts
|
|
5
5
|
interface MetaItem {
|
package/dist/helpers/capnp.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_file_header = require('../packages/powerlines/src/lib/utilities/file-header.cjs');
|
|
2
3
|
let defu = require("defu");
|
|
3
4
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
4
5
|
let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
|
|
@@ -22,7 +23,6 @@ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
|
22
23
|
let node_buffer = require("node:buffer");
|
|
23
24
|
let node_child_process = require("node:child_process");
|
|
24
25
|
let node_util = require("node:util");
|
|
25
|
-
let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
|
|
26
26
|
|
|
27
27
|
//#region src/helpers/capnp.ts
|
|
28
28
|
/**
|
|
@@ -118,7 +118,7 @@ async function generateCapnpId() {
|
|
|
118
118
|
}
|
|
119
119
|
async function generateCapnp(context, reflection, options) {
|
|
120
120
|
return `${(await generateCapnpId()).trim()};
|
|
121
|
-
${
|
|
121
|
+
${require_file_header.getBaseFileHeader(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
|
|
122
122
|
${reflection.getMethods().length === 0 ? generateCapnpStruct(reflection, options) : generateCapnpInterface(reflection, options)}
|
|
123
123
|
`.trim();
|
|
124
124
|
}
|
package/dist/helpers/capnp.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, PluginContext } from "powerlines/types/context";
|
|
1
|
+
import { Context, PluginContext } from "../powerlines/src/types/context.cjs";
|
|
2
2
|
import { ReflectionClass, ReflectionMethod, ReflectionParameter, ReflectionProperty, Type, TypeEnum, TypeUnion } from "@powerlines/deepkit/vendor/type";
|
|
3
3
|
import { CapnpcOptions, CapnpcResult } from "@stryke/capnp/types";
|
|
4
4
|
|
package/dist/helpers/capnp.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Context, PluginContext } from "../packages/powerlines/src/types/context.mjs";
|
|
1
2
|
import { ReflectionClass, ReflectionMethod, ReflectionParameter, ReflectionProperty, Type, TypeEnum, TypeUnion } from "@powerlines/deepkit/vendor/type";
|
|
2
|
-
import { Context, PluginContext } from "powerlines/types/context";
|
|
3
3
|
import { CapnpcOptions, CapnpcResult } from "@stryke/capnp/types";
|
|
4
4
|
|
|
5
5
|
//#region src/helpers/capnp.d.ts
|
package/dist/helpers/capnp.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBaseFileHeader } from "../packages/powerlines/src/lib/utilities/file-header.mjs";
|
|
1
2
|
import defu from "defu";
|
|
2
3
|
import { getUnionTypes, kindToName } from "@powerlines/deepkit/utilities";
|
|
3
4
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
@@ -20,7 +21,6 @@ import { isString } from "@stryke/type-checks/is-string";
|
|
|
20
21
|
import { Buffer } from "node:buffer";
|
|
21
22
|
import { exec } from "node:child_process";
|
|
22
23
|
import { promisify } from "node:util";
|
|
23
|
-
import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
|
|
24
24
|
|
|
25
25
|
//#region src/helpers/capnp.ts
|
|
26
26
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -3,11 +3,9 @@ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
|
3
3
|
const require_core_components_output = require('./core/components/output.cjs');
|
|
4
4
|
const require_unctx = require('./internal/unctx.cjs');
|
|
5
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
-
let __alloy_js_babel_preset = require("@alloy-js/babel-preset");
|
|
7
|
-
__alloy_js_babel_preset = require_rolldown_runtime.__toESM(__alloy_js_babel_preset);
|
|
8
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
9
|
-
let
|
|
10
|
-
|
|
7
|
+
let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
|
|
8
|
+
__alloy_js_rollup_plugin = require_rolldown_runtime.__toESM(__alloy_js_rollup_plugin);
|
|
11
9
|
let __stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
12
10
|
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
13
11
|
|
|
@@ -19,88 +17,81 @@ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
|
19
17
|
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
20
18
|
*/
|
|
21
19
|
const plugin = (options = {}) => {
|
|
22
|
-
return [
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(_, id) => /^(?:m|c)?tsx?$/.test((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true }))
|
|
37
|
-
]] } },
|
|
38
|
-
build: {
|
|
39
|
-
inputOptions: { transform: { jsx: "preserve" } },
|
|
40
|
-
external: [/^@?powerlines\//, /^@alloy-js\//]
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
async configResolved() {
|
|
45
|
-
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
46
|
-
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
47
|
-
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
48
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
49
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
50
|
-
await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
20
|
+
return [{
|
|
21
|
+
name: "alloy:config",
|
|
22
|
+
config() {
|
|
23
|
+
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
24
|
+
return {
|
|
25
|
+
alloy: {
|
|
26
|
+
typescript: true,
|
|
27
|
+
...options
|
|
28
|
+
},
|
|
29
|
+
build: {
|
|
30
|
+
inputOptions: { transform: { jsx: "preserve" } },
|
|
31
|
+
plugins: [(0, __alloy_js_rollup_plugin.default)()],
|
|
32
|
+
external: [/^@alloy-js\//],
|
|
33
|
+
noExternal: ["@powerlines/plugin-alloy"]
|
|
51
34
|
}
|
|
52
|
-
}
|
|
35
|
+
};
|
|
53
36
|
},
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
37
|
+
async configResolved() {
|
|
38
|
+
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
39
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
40
|
+
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
41
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
42
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
43
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
name: "alloy:attach-render",
|
|
48
|
+
configResolved: {
|
|
49
|
+
order: "pre",
|
|
50
|
+
async handler() {
|
|
51
|
+
this.debug("Attaching the `render` method to the context object.");
|
|
52
|
+
this.render = async (children) => {
|
|
53
|
+
const meta = {};
|
|
54
|
+
await require_unctx.unctx.callAsync({
|
|
55
|
+
value: this,
|
|
56
|
+
meta
|
|
57
|
+
}, async () => {
|
|
58
|
+
const _self$ = this;
|
|
59
|
+
await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
|
|
60
|
+
context: _self$,
|
|
61
|
+
meta,
|
|
62
|
+
get basePath() {
|
|
63
|
+
return _self$.workspaceConfig.workspaceRoot;
|
|
64
|
+
},
|
|
65
|
+
children
|
|
66
|
+
})), {
|
|
67
|
+
visitDirectory: (directory) => {
|
|
68
|
+
if (this.fs.existsSync(directory.path)) return;
|
|
69
|
+
this.fs.mkdirSync(directory.path);
|
|
70
|
+
},
|
|
71
|
+
visitFile: (file) => {
|
|
72
|
+
if ("contents" in file) {
|
|
73
|
+
const metadata = meta[file.path] ?? {};
|
|
74
|
+
if (metadata.kind === "builtin") {
|
|
75
|
+
if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
|
|
76
|
+
this.emitBuiltinSync(file.contents, metadata.id, {
|
|
90
77
|
skipFormat: metadata.skipFormat,
|
|
91
78
|
storage: metadata.storage,
|
|
92
|
-
|
|
79
|
+
extension: (0, __stryke_path_file_path_fns.findFileExtension)(file.path)
|
|
93
80
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
} else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
|
|
82
|
+
skipFormat: metadata.skipFormat,
|
|
83
|
+
storage: metadata.storage,
|
|
84
|
+
...metadata.typeDefinition ?? {}
|
|
85
|
+
});
|
|
86
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
87
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
88
|
+
}
|
|
98
89
|
});
|
|
99
|
-
};
|
|
100
|
-
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
101
92
|
}
|
|
102
93
|
}
|
|
103
|
-
];
|
|
94
|
+
}];
|
|
104
95
|
};
|
|
105
96
|
var src_default = plugin;
|
|
106
97
|
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Output as Output$1 } from "./core/components/output.mjs";
|
|
2
2
|
import { unctx } from "./internal/unctx.mjs";
|
|
3
3
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import alloyPreset from "@alloy-js/babel-preset";
|
|
5
4
|
import { renderAsync, traverseOutput } from "@alloy-js/core";
|
|
6
|
-
import
|
|
5
|
+
import rollupPlugin from "@alloy-js/rollup-plugin";
|
|
7
6
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
8
|
-
import { findFileExtension
|
|
7
|
+
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
9
8
|
|
|
10
9
|
//#region src/index.tsx
|
|
11
10
|
/**
|
|
@@ -15,88 +14,81 @@ import { findFileExtension, findFileExtensionSafe } from "@stryke/path/file-path
|
|
|
15
14
|
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
16
15
|
*/
|
|
17
16
|
const plugin = (options = {}) => {
|
|
18
|
-
return [
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(_, id) => /^(?:m|c)?tsx?$/.test(findFileExtensionSafe(id, { fullExtension: true }))
|
|
33
|
-
]] } },
|
|
34
|
-
build: {
|
|
35
|
-
inputOptions: { transform: { jsx: "preserve" } },
|
|
36
|
-
external: [/^@?powerlines\//, /^@alloy-js\//]
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
async configResolved() {
|
|
41
|
-
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
42
|
-
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
43
|
-
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
44
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
45
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
46
|
-
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
17
|
+
return [{
|
|
18
|
+
name: "alloy:config",
|
|
19
|
+
config() {
|
|
20
|
+
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
21
|
+
return {
|
|
22
|
+
alloy: {
|
|
23
|
+
typescript: true,
|
|
24
|
+
...options
|
|
25
|
+
},
|
|
26
|
+
build: {
|
|
27
|
+
inputOptions: { transform: { jsx: "preserve" } },
|
|
28
|
+
plugins: [rollupPlugin()],
|
|
29
|
+
external: [/^@alloy-js\//],
|
|
30
|
+
noExternal: ["@powerlines/plugin-alloy"]
|
|
47
31
|
}
|
|
48
|
-
}
|
|
32
|
+
};
|
|
49
33
|
},
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
34
|
+
async configResolved() {
|
|
35
|
+
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
36
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
|
|
37
|
+
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
38
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
39
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
|
|
40
|
+
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
name: "alloy:attach-render",
|
|
45
|
+
configResolved: {
|
|
46
|
+
order: "pre",
|
|
47
|
+
async handler() {
|
|
48
|
+
this.debug("Attaching the `render` method to the context object.");
|
|
49
|
+
this.render = async (children) => {
|
|
50
|
+
const meta = {};
|
|
51
|
+
await unctx.callAsync({
|
|
52
|
+
value: this,
|
|
53
|
+
meta
|
|
54
|
+
}, async () => {
|
|
55
|
+
const _self$ = this;
|
|
56
|
+
await traverseOutput(await renderAsync(createComponent(Output$1, {
|
|
57
|
+
context: _self$,
|
|
58
|
+
meta,
|
|
59
|
+
get basePath() {
|
|
60
|
+
return _self$.workspaceConfig.workspaceRoot;
|
|
61
|
+
},
|
|
62
|
+
children
|
|
63
|
+
})), {
|
|
64
|
+
visitDirectory: (directory) => {
|
|
65
|
+
if (this.fs.existsSync(directory.path)) return;
|
|
66
|
+
this.fs.mkdirSync(directory.path);
|
|
67
|
+
},
|
|
68
|
+
visitFile: (file) => {
|
|
69
|
+
if ("contents" in file) {
|
|
70
|
+
const metadata = meta[file.path] ?? {};
|
|
71
|
+
if (metadata.kind === "builtin") {
|
|
72
|
+
if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
|
|
73
|
+
this.emitBuiltinSync(file.contents, metadata.id, {
|
|
86
74
|
skipFormat: metadata.skipFormat,
|
|
87
75
|
storage: metadata.storage,
|
|
88
|
-
|
|
76
|
+
extension: findFileExtension(file.path)
|
|
89
77
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
} else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
|
|
79
|
+
skipFormat: metadata.skipFormat,
|
|
80
|
+
storage: metadata.storage,
|
|
81
|
+
...metadata.typeDefinition ?? {}
|
|
82
|
+
});
|
|
83
|
+
else this.emitSync(file.contents, file.path, metadata);
|
|
84
|
+
} else this.fs.copySync(file.sourcePath, file.path);
|
|
85
|
+
}
|
|
94
86
|
});
|
|
95
|
-
};
|
|
96
|
-
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
97
89
|
}
|
|
98
90
|
}
|
|
99
|
-
];
|
|
91
|
+
}];
|
|
100
92
|
};
|
|
101
93
|
var src_default = plugin;
|
|
102
94
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core7 from "@alloy-js/core";
|
|
2
2
|
|
|
3
3
|
//#region src/markdown/components/front-matter.d.ts
|
|
4
4
|
interface FrontMatterProps {
|
|
@@ -9,7 +9,7 @@ interface FrontMatterProps {
|
|
|
9
9
|
*
|
|
10
10
|
* @see https://jekyllrb.com/docs/front-matter/
|
|
11
11
|
*/
|
|
12
|
-
declare function FrontMatter(props: FrontMatterProps):
|
|
12
|
+
declare function FrontMatter(props: FrontMatterProps): _alloy_js_core7.Children;
|
|
13
13
|
declare type __ΩFrontMatterProps = any[];
|
|
14
14
|
//#endregion
|
|
15
15
|
export { FrontMatter, FrontMatterProps, __ΩFrontMatterProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, SourceFileHeaderProps } from "../../types/components.cjs";
|
|
2
2
|
import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.cjs";
|
|
3
3
|
import { FrontMatterProps } from "./front-matter.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _alloy_js_core5 from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/markdown/components/markdown-file.d.ts
|
|
7
7
|
type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & MarkdownFileHeaderProps;
|
|
@@ -11,7 +11,7 @@ type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps &
|
|
|
11
11
|
* @param props - The properties for the source file.
|
|
12
12
|
* @returns The rendered source file component.
|
|
13
13
|
*/
|
|
14
|
-
declare function MarkdownFile(props: MarkdownFileProps):
|
|
14
|
+
declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core5.Children;
|
|
15
15
|
type MarkdownFileHeaderProps = SourceFileHeaderProps & {
|
|
16
16
|
frontMatter?: FrontMatterProps["data"];
|
|
17
17
|
};
|
|
@@ -21,7 +21,7 @@ type MarkdownFileHeaderProps = SourceFileHeaderProps & {
|
|
|
21
21
|
* @param props - The properties for the source file header.
|
|
22
22
|
* @returns The rendered source file header.
|
|
23
23
|
*/
|
|
24
|
-
declare function MarkdownFileHeader(props: MarkdownFileHeaderProps):
|
|
24
|
+
declare function MarkdownFileHeader(props: MarkdownFileHeaderProps): _alloy_js_core5.Children;
|
|
25
25
|
declare type __ΩMarkdownFileProps = any[];
|
|
26
26
|
declare type __ΩMarkdownFileHeaderProps = any[];
|
|
27
27
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
2
|
import { MarkdownTableColumnContextInterface } from "../contexts/markdown-table.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core2 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/components/markdown-table.d.ts
|
|
6
6
|
interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
|
|
@@ -9,18 +9,18 @@ interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>
|
|
|
9
9
|
/**
|
|
10
10
|
* Component that provides a context for rendering markdown tables.
|
|
11
11
|
*/
|
|
12
|
-
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>):
|
|
12
|
+
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core2.Children;
|
|
13
13
|
type MarkdownTableColumnProps = ComponentProps & Partial<Pick<MarkdownTableColumnContextInterface, "align">> & Required<Pick<MarkdownTableColumnContextInterface, "name">> & {
|
|
14
14
|
width?: number;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Component that provides a context for rendering markdown tables.
|
|
18
18
|
*/
|
|
19
|
-
declare function MarkdownTableColumn(props: MarkdownTableColumnProps):
|
|
19
|
+
declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
|
|
20
20
|
/**
|
|
21
21
|
* Component that provides a context for rendering markdown tables.
|
|
22
22
|
*/
|
|
23
|
-
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps):
|
|
23
|
+
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
|
|
24
24
|
declare type __ΩMarkdownTableProps = any[];
|
|
25
25
|
declare type __ΩMarkdownTableColumnProps = any[];
|
|
26
26
|
//#endregion
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SelectHooksOptions } from "../../types/context.mjs";
|
|
2
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/internal/helpers/hooks.d.ts
|
|
5
|
+
type CallHookOptions = SelectHooksOptions & (({
|
|
6
|
+
/**
|
|
7
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue true
|
|
10
|
+
*/
|
|
11
|
+
sequential?: true;
|
|
12
|
+
} & ({
|
|
13
|
+
/**
|
|
14
|
+
* How to handle multiple return values from hooks.
|
|
15
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
16
|
+
* - "first": Return the first non-undefined value.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Merging only works if the return values are objects.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue "merge"
|
|
22
|
+
*/
|
|
23
|
+
result: "first";
|
|
24
|
+
} | {
|
|
25
|
+
/**
|
|
26
|
+
* How to handle multiple return values from hooks.
|
|
27
|
+
* - "merge": Merge all non-undefined return values (if they are objects).
|
|
28
|
+
* - "first": Return the first non-undefined value.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Merging only works if the return values are objects.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue "merge"
|
|
34
|
+
*/
|
|
35
|
+
result?: "merge" | "last";
|
|
36
|
+
/**
|
|
37
|
+
* An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
|
|
38
|
+
*/
|
|
39
|
+
asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
|
|
40
|
+
})) | {
|
|
41
|
+
/**
|
|
42
|
+
* Whether to call the hooks sequentially or in parallel.
|
|
43
|
+
*/
|
|
44
|
+
sequential: false;
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { CallHookOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
5
|
+
function getBaseFileHeader(context) {
|
|
6
|
+
return `
|
|
7
|
+
// Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
|
|
8
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
9
|
+
`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.getBaseFileHeader = getBaseFileHeader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
4
|
+
function getBaseFileHeader(context) {
|
|
5
|
+
return `
|
|
6
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
7
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
8
|
+
`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getBaseFileHeader };
|