@powerlines/plugin-alloy 0.19.5 → 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/index.cjs +6 -6
- package/dist/core/components/output.d.cts +6 -6
- package/dist/core/components/output.d.mts +6 -6
- package/dist/core/components/output.mjs +4 -4
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/components/source-file.d.cts +5 -5
- package/dist/core/components/source-file.d.mts +6 -6
- package/dist/core/contexts/context.d.cts +2 -2
- package/dist/core/contexts/context.d.mts +2 -2
- package/dist/core/index.cjs +6 -6
- 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 +70 -79
- 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/front-matter.d.mts +2 -2
- package/dist/markdown/components/index.cjs +9 -9
- package/dist/markdown/components/markdown-file.cjs +10 -10
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/markdown/index.cjs +9 -9
- 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.cjs +6 -6
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- 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.cjs +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/index.cjs +43 -43
- package/dist/typescript/components/tsdoc-reflection.cjs +7 -7
- 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-file.cjs +8 -8
- package/dist/typescript/components/typescript-interface.cjs +3 -3
- 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.cjs +3 -3
- package/dist/typescript/components/typescript-object.d.cts +3 -3
- package/dist/typescript/index.cjs +43 -43
- package/package.json +78 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const require_core_components_output = require('./output.cjs');
|
|
2
|
+
const require_core_components_single_line_comment = require('./single-line-comment.cjs');
|
|
3
|
+
const require_core_components_source_file = require('./source-file.cjs');
|
|
4
4
|
|
|
5
|
-
exports.Output =
|
|
6
|
-
exports.SingleLineComment =
|
|
7
|
-
exports.SourceFile =
|
|
5
|
+
exports.Output = require_core_components_output.Output;
|
|
6
|
+
exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
|
|
7
|
+
exports.SourceFile = require_core_components_source_file.SourceFile;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { PluginContext } from "../../powerlines/src/types/context.cjs";
|
|
1
2
|
import { MetaItem } from "../contexts/context.cjs";
|
|
2
|
-
import * as
|
|
3
|
-
import { OutputProps } from "@alloy-js/core";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
4
|
+
import { OutputProps as OutputProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/output.d.ts
|
|
7
|
-
interface OutputProps
|
|
7
|
+
interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
|
|
8
8
|
/**
|
|
9
9
|
* The current Powerlines process context.
|
|
10
10
|
*/
|
|
@@ -17,7 +17,7 @@ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta ex
|
|
|
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
|
|
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
|
-
export { Output, OutputProps
|
|
23
|
+
export { Output, OutputProps, __ΩOutputProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { PluginContext } from "../../packages/powerlines/src/types/context.mjs";
|
|
1
2
|
import { MetaItem } from "../contexts/context.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import { OutputProps } from "@alloy-js/core";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
4
|
+
import { OutputProps as OutputProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/output.d.ts
|
|
7
|
-
interface OutputProps
|
|
7
|
+
interface OutputProps<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>> extends OutputProps$1 {
|
|
8
8
|
/**
|
|
9
9
|
* The current Powerlines process context.
|
|
10
10
|
*/
|
|
@@ -17,7 +17,7 @@ interface OutputProps$1<TContext extends PluginContext = PluginContext, TMeta ex
|
|
|
17
17
|
/**
|
|
18
18
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
19
19
|
*/
|
|
20
|
-
declare function Output
|
|
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
|
-
export { Output
|
|
23
|
+
export { Output, OutputProps, __ΩOutputProps };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Output, Show, computed, splitProps } from "@alloy-js/core";
|
|
2
|
+
import { Output as Output$1, Show, computed, splitProps } from "@alloy-js/core";
|
|
3
3
|
import { replacePath } from "@stryke/path/replace";
|
|
4
4
|
|
|
5
5
|
//#region src/core/components/output.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Output component for rendering the Powerlines plugin's output files via templates.
|
|
8
8
|
*/
|
|
9
|
-
function Output
|
|
9
|
+
function Output(props) {
|
|
10
10
|
const [{ children, context, basePath }, rest] = splitProps(props, [
|
|
11
11
|
"children",
|
|
12
12
|
"context",
|
|
13
13
|
"basePath"
|
|
14
14
|
]);
|
|
15
15
|
const basePathRef = computed(() => basePath ? replacePath(basePath, context.workspaceConfig.workspaceRoot) : context.workspaceConfig.workspaceRoot);
|
|
16
|
-
return createComponent(Output, mergeProps(rest, {
|
|
16
|
+
return createComponent(Output$1, mergeProps(rest, {
|
|
17
17
|
get basePath() {
|
|
18
18
|
return basePathRef.value;
|
|
19
19
|
},
|
|
@@ -29,4 +29,4 @@ function Output$1(props) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
export { Output
|
|
32
|
+
export { Output };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/core/components/single-line-comment.d.ts
|
|
5
5
|
type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
|
|
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
|
|
|
15
15
|
* A single line comment block. The children are rendered as a prose element, which means that they
|
|
16
16
|
* are broken into multiple lines
|
|
17
17
|
*/
|
|
18
|
-
declare function SingleLineComment(props: SingleLineCommentProps):
|
|
18
|
+
declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core0.Children;
|
|
19
19
|
declare type __ΩSingleLineCommentVariant = any[];
|
|
20
20
|
declare type __ΩSingleLineCommentProps = any[];
|
|
21
21
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { StoragePreset } from "../../powerlines/src/types/fs.cjs";
|
|
1
2
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
3
|
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
import { SourceFileProps } from "@alloy-js/core";
|
|
4
|
-
import { StoragePreset } from "powerlines/types/fs";
|
|
4
|
+
import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/source-file.d.ts
|
|
7
|
-
type SourceFileProps
|
|
7
|
+
type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
8
8
|
/**
|
|
9
9
|
* The storage preset for the output files.
|
|
10
10
|
*
|
|
@@ -26,7 +26,7 @@ type SourceFileProps$1 = SourceFileProps & 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
|
-
export { SourceFile, SourceFileProps
|
|
32
|
+
export { SourceFile, SourceFileProps, __ΩSourceFileProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { StoragePreset } from "../../packages/powerlines/src/types/fs.mjs";
|
|
1
2
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import { SourceFileProps } from "@alloy-js/core";
|
|
4
|
-
import { StoragePreset } from "powerlines/types/fs";
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
|
+
import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
|
|
5
5
|
|
|
6
6
|
//#region src/core/components/source-file.d.ts
|
|
7
|
-
type SourceFileProps
|
|
7
|
+
type SourceFileProps = SourceFileProps$1 & ComponentProps & {
|
|
8
8
|
/**
|
|
9
9
|
* The storage preset for the output files.
|
|
10
10
|
*
|
|
@@ -26,7 +26,7 @@ type SourceFileProps$1 = SourceFileProps & 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
|
-
export { SourceFile, SourceFileProps
|
|
32
|
+
export { SourceFile, SourceFileProps, __ΩSourceFileProps };
|
|
@@ -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/core/index.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_core_components_output = require('./components/output.cjs');
|
|
2
|
+
const require_core_components_single_line_comment = require('./components/single-line-comment.cjs');
|
|
3
3
|
const require_core_contexts_context = require('./contexts/context.cjs');
|
|
4
4
|
const require_core_contexts_reflection = require('./contexts/reflection.cjs');
|
|
5
5
|
require('./contexts/index.cjs');
|
|
6
|
-
const
|
|
6
|
+
const require_core_components_source_file = require('./components/source-file.cjs');
|
|
7
7
|
require('./components/index.cjs');
|
|
8
8
|
|
|
9
|
-
exports.Output =
|
|
9
|
+
exports.Output = require_core_components_output.Output;
|
|
10
10
|
exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
|
|
11
11
|
exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
|
|
12
12
|
exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
|
|
13
13
|
exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
|
|
14
|
-
exports.SingleLineComment =
|
|
15
|
-
exports.SourceFile =
|
|
14
|
+
exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
|
|
15
|
+
exports.SourceFile = require_core_components_source_file.SourceFile;
|
|
16
16
|
exports.useMeta = require_core_contexts_context.useMeta;
|
|
17
17
|
exports.useMetaSafe = require_core_contexts_context.useMetaSafe;
|
|
18
18
|
exports.usePowerlines = require_core_contexts_context.usePowerlines;
|
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
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const
|
|
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
|
|