@powerlines/plugin-alloy 0.18.50 → 0.18.53
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 +7 -0
- package/dist/core/components/index.d.cts +4 -0
- package/dist/core/components/index.d.mts +4 -0
- package/dist/core/components/index.mjs +5 -0
- package/dist/core/components/output.cjs +2 -2
- package/dist/core/components/output.d.cts +23 -0
- package/dist/core/components/output.d.mts +23 -0
- package/dist/core/components/output.mjs +4 -4
- package/dist/core/components/single-line-comment.cjs +22 -0
- package/dist/core/components/single-line-comment.d.cts +22 -0
- package/dist/core/components/single-line-comment.d.mts +22 -0
- package/dist/core/components/single-line-comment.mjs +21 -0
- package/dist/core/components/source-file.cjs +64 -0
- package/dist/core/components/source-file.d.cts +32 -0
- package/dist/core/components/source-file.d.mts +32 -0
- package/dist/core/components/source-file.mjs +62 -0
- package/dist/core/contexts/context.cjs +50 -1
- package/dist/core/contexts/context.d.cts +71 -0
- package/dist/core/contexts/context.d.mts +71 -0
- package/dist/core/contexts/context.mjs +46 -2
- package/dist/core/contexts/index.cjs +17 -0
- package/dist/core/contexts/index.d.cts +3 -0
- package/dist/core/contexts/index.d.mts +3 -0
- package/dist/core/contexts/index.mjs +4 -0
- package/dist/core/contexts/reflection.cjs +68 -0
- package/dist/core/contexts/reflection.d.cts +52 -0
- package/dist/core/contexts/reflection.d.mts +52 -0
- package/dist/core/contexts/reflection.mjs +60 -0
- package/dist/core/index.cjs +25 -0
- package/dist/core/index.d.cts +7 -0
- package/dist/core/index.d.mts +8 -0
- package/dist/core/index.mjs +9 -0
- package/dist/helpers/capnp.cjs +276 -0
- package/dist/helpers/capnp.d.cts +87 -0
- package/dist/helpers/capnp.d.mts +87 -0
- package/dist/helpers/capnp.mjs +259 -0
- package/dist/helpers/create-builtin.cjs +19 -0
- package/dist/helpers/create-builtin.d.cts +15 -0
- package/dist/helpers/create-builtin.d.mts +15 -0
- package/dist/helpers/create-builtin.mjs +18 -0
- package/dist/helpers/index.cjs +24 -0
- package/dist/helpers/index.d.cts +5 -0
- package/dist/helpers/index.d.mts +5 -0
- package/dist/helpers/index.mjs +6 -0
- package/dist/helpers/refkey.cjs +16 -0
- package/dist/helpers/refkey.d.cts +13 -0
- package/dist/helpers/refkey.d.mts +13 -0
- package/dist/helpers/refkey.mjs +15 -0
- package/dist/helpers/typescript.cjs +46 -0
- package/dist/helpers/typescript.d.cts +25 -0
- package/dist/helpers/typescript.d.mts +25 -0
- package/dist/helpers/typescript.mjs +45 -0
- package/dist/index.cjs +2 -2
- package/dist/markdown/components/index.cjs +8 -0
- package/dist/markdown/components/index.d.cts +3 -0
- package/dist/markdown/components/index.d.mts +3 -0
- package/dist/markdown/components/index.mjs +4 -0
- package/dist/markdown/components/markdown-file.cjs +116 -0
- package/dist/markdown/components/markdown-file.d.cts +23 -0
- package/dist/markdown/components/markdown-file.d.mts +23 -0
- package/dist/markdown/components/markdown-file.mjs +114 -0
- package/dist/markdown/components/markdown-table.cjs +101 -0
- package/dist/markdown/components/markdown-table.d.cts +27 -0
- package/dist/markdown/components/markdown-table.d.mts +27 -0
- package/dist/markdown/components/markdown-table.mjs +98 -0
- package/dist/markdown/contexts/index.cjs +6 -0
- package/dist/markdown/contexts/index.d.cts +2 -0
- package/dist/markdown/contexts/index.d.mts +2 -0
- package/dist/markdown/contexts/index.mjs +3 -0
- package/dist/markdown/contexts/markdown-table.cjs +37 -0
- package/dist/markdown/contexts/markdown-table.d.cts +37 -0
- package/dist/markdown/contexts/markdown-table.d.mts +37 -0
- package/dist/markdown/contexts/markdown-table.mjs +33 -0
- package/dist/markdown/index.cjs +15 -0
- package/dist/markdown/index.d.cts +4 -0
- package/dist/markdown/index.d.mts +6 -0
- package/dist/markdown/index.mjs +7 -0
- package/dist/powerlines/src/types/api.d.cts +3 -3
- package/dist/powerlines/src/types/api.d.mts +3 -3
- package/dist/powerlines/src/types/build.d.cts +10 -10
- package/dist/powerlines/src/types/build.d.mts +10 -10
- package/dist/powerlines/src/types/commands.d.cts +1 -1
- package/dist/powerlines/src/types/commands.d.mts +1 -1
- package/dist/powerlines/src/types/config.d.cts +2 -2
- package/dist/powerlines/src/types/config.d.mts +2 -2
- package/dist/powerlines/src/types/context.d.cts +5 -5
- package/dist/powerlines/src/types/context.d.mts +5 -5
- package/dist/powerlines/src/types/hooks.d.cts +1 -1
- package/dist/powerlines/src/types/hooks.d.mts +1 -1
- package/dist/powerlines/src/types/plugin.d.cts +5 -5
- package/dist/powerlines/src/types/plugin.d.mts +5 -5
- package/dist/powerlines/src/types/resolved.d.cts +1 -1
- package/dist/powerlines/src/types/resolved.d.mts +1 -1
- package/dist/powerlines/src/types/unplugin.d.cts +1 -1
- package/dist/powerlines/src/types/unplugin.d.mts +1 -1
- package/dist/types/components.cjs +0 -0
- package/dist/types/components.d.cts +142 -0
- package/dist/types/components.d.mts +142 -0
- package/dist/types/components.mjs +1 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +9 -1
- package/dist/types/plugin.d.mts +9 -1
- package/dist/types/plugin.mjs +1 -0
- package/dist/typescript/components/builtin-file.cjs +62 -0
- package/dist/typescript/components/builtin-file.d.cts +34 -0
- package/dist/typescript/components/builtin-file.d.mts +34 -0
- package/dist/typescript/components/builtin-file.mjs +61 -0
- package/dist/typescript/components/dynamic-import-statement.cjs +25 -0
- package/dist/typescript/components/dynamic-import-statement.d.cts +32 -0
- package/dist/typescript/components/dynamic-import-statement.d.mts +32 -0
- package/dist/typescript/components/dynamic-import-statement.mjs +24 -0
- package/dist/typescript/components/entry-file.cjs +41 -0
- package/dist/typescript/components/entry-file.d.cts +27 -0
- package/dist/typescript/components/entry-file.d.mts +27 -0
- package/dist/typescript/components/entry-file.mjs +39 -0
- package/dist/typescript/components/index.cjs +44 -0
- package/dist/typescript/components/index.d.cts +10 -0
- package/dist/typescript/components/index.d.mts +10 -0
- package/dist/typescript/components/index.mjs +11 -0
- package/dist/typescript/components/record-expression.cjs +12 -0
- package/dist/typescript/components/record-expression.d.cts +12 -0
- package/dist/typescript/components/record-expression.d.mts +12 -0
- package/dist/typescript/components/record-expression.mjs +11 -0
- package/dist/typescript/components/tsdoc-reflection.cjs +177 -0
- package/dist/typescript/components/tsdoc-reflection.d.cts +18 -0
- package/dist/typescript/components/tsdoc-reflection.d.mts +18 -0
- package/dist/typescript/components/tsdoc-reflection.mjs +174 -0
- package/dist/typescript/components/tsdoc.cjs +481 -0
- package/dist/typescript/components/tsdoc.d.cts +163 -0
- package/dist/typescript/components/tsdoc.d.mts +163 -0
- package/dist/typescript/components/tsdoc.mjs +461 -0
- package/dist/typescript/components/typescript-file.cjs +216 -0
- package/dist/typescript/components/typescript-file.d.cts +49 -0
- package/dist/typescript/components/typescript-file.d.mts +49 -0
- package/dist/typescript/components/typescript-file.mjs +213 -0
- package/dist/typescript/components/typescript-interface.cjs +69 -0
- package/dist/typescript/components/typescript-interface.d.cts +25 -0
- package/dist/typescript/components/typescript-interface.d.mts +25 -0
- package/dist/typescript/components/typescript-interface.mjs +67 -0
- package/dist/typescript/components/typescript-object.cjs +125 -0
- package/dist/typescript/components/typescript-object.d.cts +26 -0
- package/dist/typescript/components/typescript-object.d.mts +26 -0
- package/dist/typescript/components/typescript-object.mjs +123 -0
- package/dist/typescript/index.cjs +45 -0
- package/dist/typescript/index.d.cts +11 -0
- package/dist/typescript/index.d.mts +11 -0
- package/dist/typescript/index.mjs +12 -0
- package/package.json +6 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BuilderVariant } from "./build.mjs";
|
|
2
2
|
import { ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, OutputConfig, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig as UserConfig$1, ViteUserConfig, WebpackUserConfig } from "./config.mjs";
|
|
3
3
|
import { NonUndefined } from "@stryke/types/base";
|
|
4
|
-
import { ResolvedPreviewOptions } from "vite";
|
|
5
4
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
6
5
|
import { AssetGlob } from "@stryke/types/file";
|
|
6
|
+
import { ResolvedPreviewOptions } from "vite";
|
|
7
7
|
|
|
8
8
|
//#region ../powerlines/src/types/resolved.d.ts
|
|
9
9
|
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.cjs";
|
|
2
2
|
import { InferResolvedConfig } from "./resolved.cjs";
|
|
3
|
-
import { Context } from "./context.cjs";
|
|
4
3
|
import { API } from "./api.cjs";
|
|
5
4
|
import { PluginHook } from "./plugin.cjs";
|
|
5
|
+
import { Context } from "./context.cjs";
|
|
6
6
|
import { MaybePromise } from "@stryke/types/base";
|
|
7
7
|
import { HookFilter, UnpluginOptions } from "unplugin";
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BuilderVariant, InferUnpluginVariant, UnpluginBuilderVariant } from "./build.mjs";
|
|
2
2
|
import { InferResolvedConfig } from "./resolved.mjs";
|
|
3
|
-
import { Context } from "./context.mjs";
|
|
4
3
|
import { API } from "./api.mjs";
|
|
5
4
|
import { PluginHook } from "./plugin.mjs";
|
|
5
|
+
import { Context } from "./context.mjs";
|
|
6
6
|
import { MaybePromise } from "@stryke/types/base";
|
|
7
7
|
import { HookFilter, UnpluginOptions } from "unplugin";
|
|
8
8
|
|
|
File without changes
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { StoragePreset } from "../powerlines/src/types/fs.cjs";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "../powerlines/src/types/resolved.cjs";
|
|
3
|
+
import { Children, Context } from "@alloy-js/core";
|
|
4
|
+
import { SourceFileContext } from "@alloy-js/typescript";
|
|
5
|
+
|
|
6
|
+
//#region src/types/components.d.ts
|
|
7
|
+
interface CopyOutputFile {
|
|
8
|
+
kind: "file";
|
|
9
|
+
path: string;
|
|
10
|
+
sourcePath: string;
|
|
11
|
+
/**
|
|
12
|
+
* The format of the output files
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* If not specified, the output mode will be determined by the provided \`output.mode\` value.
|
|
16
|
+
*/
|
|
17
|
+
preset?: StoragePreset;
|
|
18
|
+
}
|
|
19
|
+
interface WriteOutputFile {
|
|
20
|
+
kind: "file" | "entry" | "builtin";
|
|
21
|
+
path: string;
|
|
22
|
+
contents: string;
|
|
23
|
+
filetype: string;
|
|
24
|
+
/**
|
|
25
|
+
* The format of the output files
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* If not specified, the output mode will be determined by the provided \`output.mode\` value.
|
|
29
|
+
*/
|
|
30
|
+
preset?: StoragePreset;
|
|
31
|
+
}
|
|
32
|
+
type OutputFile = (WriteOutputFile & {
|
|
33
|
+
kind: "file";
|
|
34
|
+
}) | (WriteOutputFile & {
|
|
35
|
+
kind: "entry";
|
|
36
|
+
typeDefinition?: ResolvedEntryTypeDefinition;
|
|
37
|
+
}) | (WriteOutputFile & {
|
|
38
|
+
kind: "builtin";
|
|
39
|
+
id: string;
|
|
40
|
+
}) | CopyOutputFile;
|
|
41
|
+
interface OutputDirectory {
|
|
42
|
+
kind: "directory";
|
|
43
|
+
path: string;
|
|
44
|
+
contents: (OutputDirectory | OutputFile)[];
|
|
45
|
+
}
|
|
46
|
+
interface RenderEntryContext {
|
|
47
|
+
typeDefinition: ResolvedEntryTypeDefinition;
|
|
48
|
+
}
|
|
49
|
+
interface RenderBuiltinContext {
|
|
50
|
+
id: string;
|
|
51
|
+
}
|
|
52
|
+
interface RenderOutputContext {
|
|
53
|
+
mode?: StoragePreset;
|
|
54
|
+
}
|
|
55
|
+
interface CopyFileOutputContext {
|
|
56
|
+
path?: string;
|
|
57
|
+
sourcePath?: string;
|
|
58
|
+
}
|
|
59
|
+
interface RenderContext extends Context {
|
|
60
|
+
meta?: {
|
|
61
|
+
copyFile?: CopyFileOutputContext;
|
|
62
|
+
/**
|
|
63
|
+
* The current context for the built-in module.
|
|
64
|
+
*/
|
|
65
|
+
builtin?: RenderBuiltinContext;
|
|
66
|
+
/**
|
|
67
|
+
* The current context for the application entrypoint file being rendered.
|
|
68
|
+
*/
|
|
69
|
+
entry?: RenderEntryContext;
|
|
70
|
+
/**
|
|
71
|
+
* The current context for output rendering.
|
|
72
|
+
*/
|
|
73
|
+
output?: RenderOutputContext;
|
|
74
|
+
} & Record<string, any>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A type that represents the props of a component that can have children.
|
|
78
|
+
*/
|
|
79
|
+
interface ComponentProps {
|
|
80
|
+
children?: Children;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A type that requires the `children` prop in a component.
|
|
84
|
+
*/
|
|
85
|
+
type ComponentPropsWithChildren = Omit<ComponentProps, "children"> & Required<Pick<ComponentProps, "children">>;
|
|
86
|
+
interface BuiltinSourceFileContext extends SourceFileContext {
|
|
87
|
+
/**
|
|
88
|
+
* The runtime module identifier.
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
}
|
|
92
|
+
interface ReflectionOverrideInterface<T> {
|
|
93
|
+
name?: string | Children;
|
|
94
|
+
type?: string | Children;
|
|
95
|
+
extends?: string | false;
|
|
96
|
+
defaultValue?: Partial<T>;
|
|
97
|
+
}
|
|
98
|
+
interface TypescriptFileImportItem {
|
|
99
|
+
name: string;
|
|
100
|
+
default?: boolean;
|
|
101
|
+
alias?: string;
|
|
102
|
+
type?: boolean;
|
|
103
|
+
}
|
|
104
|
+
type TypescriptFileImports = Record<string, null | string | Array<TypescriptFileImportItem | string>>;
|
|
105
|
+
interface SourceFileHeaderProps extends ComponentProps {
|
|
106
|
+
/**
|
|
107
|
+
* If true, disables the ESLint directive at the top of the file.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue true
|
|
110
|
+
*/
|
|
111
|
+
disableEslint?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* If true, disables the Biome directive at the top of the file.
|
|
114
|
+
*
|
|
115
|
+
* @defaultValue true
|
|
116
|
+
*/
|
|
117
|
+
disableBiome?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* If true, disables the Prettier directive at the top of the file.
|
|
120
|
+
*
|
|
121
|
+
* @defaultValue false
|
|
122
|
+
*/
|
|
123
|
+
disablePrettier?: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare type __ΩCopyOutputFile = any[];
|
|
126
|
+
declare type __ΩWriteOutputFile = any[];
|
|
127
|
+
declare type __ΩOutputFile = any[];
|
|
128
|
+
declare type __ΩOutputDirectory = any[];
|
|
129
|
+
declare type __ΩRenderEntryContext = any[];
|
|
130
|
+
declare type __ΩRenderBuiltinContext = any[];
|
|
131
|
+
declare type __ΩRenderOutputContext = any[];
|
|
132
|
+
declare type __ΩCopyFileOutputContext = any[];
|
|
133
|
+
declare type __ΩRenderContext = any[];
|
|
134
|
+
declare type __ΩComponentProps = any[];
|
|
135
|
+
declare type __ΩComponentPropsWithChildren = any[];
|
|
136
|
+
declare type __ΩBuiltinSourceFileContext = any[];
|
|
137
|
+
declare type __ΩReflectionOverrideInterface = any[];
|
|
138
|
+
declare type __ΩTypescriptFileImportItem = any[];
|
|
139
|
+
declare type __ΩTypescriptFileImports = any[];
|
|
140
|
+
declare type __ΩSourceFileHeaderProps = any[];
|
|
141
|
+
//#endregion
|
|
142
|
+
export { BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { StoragePreset } from "../powerlines/src/types/fs.mjs";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "../powerlines/src/types/resolved.mjs";
|
|
3
|
+
import { Children, Context } from "@alloy-js/core";
|
|
4
|
+
import { SourceFileContext as SourceFileContext$1 } from "@alloy-js/typescript";
|
|
5
|
+
|
|
6
|
+
//#region src/types/components.d.ts
|
|
7
|
+
interface CopyOutputFile {
|
|
8
|
+
kind: "file";
|
|
9
|
+
path: string;
|
|
10
|
+
sourcePath: string;
|
|
11
|
+
/**
|
|
12
|
+
* The format of the output files
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* If not specified, the output mode will be determined by the provided \`output.mode\` value.
|
|
16
|
+
*/
|
|
17
|
+
preset?: StoragePreset;
|
|
18
|
+
}
|
|
19
|
+
interface WriteOutputFile {
|
|
20
|
+
kind: "file" | "entry" | "builtin";
|
|
21
|
+
path: string;
|
|
22
|
+
contents: string;
|
|
23
|
+
filetype: string;
|
|
24
|
+
/**
|
|
25
|
+
* The format of the output files
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* If not specified, the output mode will be determined by the provided \`output.mode\` value.
|
|
29
|
+
*/
|
|
30
|
+
preset?: StoragePreset;
|
|
31
|
+
}
|
|
32
|
+
type OutputFile = (WriteOutputFile & {
|
|
33
|
+
kind: "file";
|
|
34
|
+
}) | (WriteOutputFile & {
|
|
35
|
+
kind: "entry";
|
|
36
|
+
typeDefinition?: ResolvedEntryTypeDefinition;
|
|
37
|
+
}) | (WriteOutputFile & {
|
|
38
|
+
kind: "builtin";
|
|
39
|
+
id: string;
|
|
40
|
+
}) | CopyOutputFile;
|
|
41
|
+
interface OutputDirectory {
|
|
42
|
+
kind: "directory";
|
|
43
|
+
path: string;
|
|
44
|
+
contents: (OutputDirectory | OutputFile)[];
|
|
45
|
+
}
|
|
46
|
+
interface RenderEntryContext {
|
|
47
|
+
typeDefinition: ResolvedEntryTypeDefinition;
|
|
48
|
+
}
|
|
49
|
+
interface RenderBuiltinContext {
|
|
50
|
+
id: string;
|
|
51
|
+
}
|
|
52
|
+
interface RenderOutputContext {
|
|
53
|
+
mode?: StoragePreset;
|
|
54
|
+
}
|
|
55
|
+
interface CopyFileOutputContext {
|
|
56
|
+
path?: string;
|
|
57
|
+
sourcePath?: string;
|
|
58
|
+
}
|
|
59
|
+
interface RenderContext extends Context {
|
|
60
|
+
meta?: {
|
|
61
|
+
copyFile?: CopyFileOutputContext;
|
|
62
|
+
/**
|
|
63
|
+
* The current context for the built-in module.
|
|
64
|
+
*/
|
|
65
|
+
builtin?: RenderBuiltinContext;
|
|
66
|
+
/**
|
|
67
|
+
* The current context for the application entrypoint file being rendered.
|
|
68
|
+
*/
|
|
69
|
+
entry?: RenderEntryContext;
|
|
70
|
+
/**
|
|
71
|
+
* The current context for output rendering.
|
|
72
|
+
*/
|
|
73
|
+
output?: RenderOutputContext;
|
|
74
|
+
} & Record<string, any>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A type that represents the props of a component that can have children.
|
|
78
|
+
*/
|
|
79
|
+
interface ComponentProps {
|
|
80
|
+
children?: Children;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A type that requires the `children` prop in a component.
|
|
84
|
+
*/
|
|
85
|
+
type ComponentPropsWithChildren = Omit<ComponentProps, "children"> & Required<Pick<ComponentProps, "children">>;
|
|
86
|
+
interface BuiltinSourceFileContext extends SourceFileContext$1 {
|
|
87
|
+
/**
|
|
88
|
+
* The runtime module identifier.
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
}
|
|
92
|
+
interface ReflectionOverrideInterface<T> {
|
|
93
|
+
name?: string | Children;
|
|
94
|
+
type?: string | Children;
|
|
95
|
+
extends?: string | false;
|
|
96
|
+
defaultValue?: Partial<T>;
|
|
97
|
+
}
|
|
98
|
+
interface TypescriptFileImportItem {
|
|
99
|
+
name: string;
|
|
100
|
+
default?: boolean;
|
|
101
|
+
alias?: string;
|
|
102
|
+
type?: boolean;
|
|
103
|
+
}
|
|
104
|
+
type TypescriptFileImports = Record<string, null | string | Array<TypescriptFileImportItem | string>>;
|
|
105
|
+
interface SourceFileHeaderProps extends ComponentProps {
|
|
106
|
+
/**
|
|
107
|
+
* If true, disables the ESLint directive at the top of the file.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue true
|
|
110
|
+
*/
|
|
111
|
+
disableEslint?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* If true, disables the Biome directive at the top of the file.
|
|
114
|
+
*
|
|
115
|
+
* @defaultValue true
|
|
116
|
+
*/
|
|
117
|
+
disableBiome?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* If true, disables the Prettier directive at the top of the file.
|
|
120
|
+
*
|
|
121
|
+
* @defaultValue false
|
|
122
|
+
*/
|
|
123
|
+
disablePrettier?: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare type __ΩCopyOutputFile = any[];
|
|
126
|
+
declare type __ΩWriteOutputFile = any[];
|
|
127
|
+
declare type __ΩOutputFile = any[];
|
|
128
|
+
declare type __ΩOutputDirectory = any[];
|
|
129
|
+
declare type __ΩRenderEntryContext = any[];
|
|
130
|
+
declare type __ΩRenderBuiltinContext = any[];
|
|
131
|
+
declare type __ΩRenderOutputContext = any[];
|
|
132
|
+
declare type __ΩCopyFileOutputContext = any[];
|
|
133
|
+
declare type __ΩRenderContext = any[];
|
|
134
|
+
declare type __ΩComponentProps = any[];
|
|
135
|
+
declare type __ΩComponentPropsWithChildren = any[];
|
|
136
|
+
declare type __ΩBuiltinSourceFileContext = any[];
|
|
137
|
+
declare type __ΩReflectionOverrideInterface = any[];
|
|
138
|
+
declare type __ΩTypescriptFileImportItem = any[];
|
|
139
|
+
declare type __ΩTypescriptFileImports = any[];
|
|
140
|
+
declare type __ΩSourceFileHeaderProps = any[];
|
|
141
|
+
//#endregion
|
|
142
|
+
export { BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile } from "./components.cjs";
|
|
2
|
+
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig } from "./plugin.cjs";
|
|
3
|
+
export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile } from "./components.mjs";
|
|
2
|
+
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig } from "./plugin.mjs";
|
|
3
|
+
export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, BuiltinSourceFileContext, ComponentProps, ComponentPropsWithChildren, CopyFileOutputContext, CopyOutputFile, OutputDirectory, OutputFile, ReflectionOverrideInterface, RenderBuiltinContext, RenderContext, RenderEntryContext, RenderOutputContext, SourceFileHeaderProps, TypescriptFileImportItem, TypescriptFileImports, WriteOutputFile, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig, __ΩBuiltinSourceFileContext, __ΩComponentProps, __ΩComponentPropsWithChildren, __ΩCopyFileOutputContext, __ΩCopyOutputFile, __ΩOutputDirectory, __ΩOutputFile, __ΩReflectionOverrideInterface, __ΩRenderBuiltinContext, __ΩRenderContext, __ΩRenderEntryContext, __ΩRenderOutputContext, __ΩSourceFileHeaderProps, __ΩTypescriptFileImportItem, __ΩTypescriptFileImports, __ΩWriteOutputFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResolvedConfig } from "../powerlines/src/types/resolved.cjs";
|
|
2
|
+
import { UserConfig } from "../powerlines/src/types/config.cjs";
|
|
2
3
|
import { PluginContext } from "../powerlines/src/types/context.cjs";
|
|
3
4
|
import { Children, PrintTreeOptions } from "@alloy-js/core";
|
|
4
5
|
|
|
@@ -23,11 +24,18 @@ type AlloyPluginOptions = Partial<PrintTreeOptions> & {
|
|
|
23
24
|
*/
|
|
24
25
|
markdown?: boolean;
|
|
25
26
|
};
|
|
27
|
+
type AlloyPluginUserConfig = UserConfig & {
|
|
28
|
+
alloy?: AlloyPluginOptions;
|
|
29
|
+
};
|
|
26
30
|
type AlloyPluginResolvedConfig = ResolvedConfig & {
|
|
27
31
|
alloy: AlloyPluginOptions;
|
|
28
32
|
};
|
|
29
33
|
type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
30
34
|
render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
|
|
31
35
|
};
|
|
36
|
+
declare type __ΩAlloyPluginOptions = any[];
|
|
37
|
+
declare type __ΩAlloyPluginUserConfig = any[];
|
|
38
|
+
declare type __ΩAlloyPluginResolvedConfig = any[];
|
|
39
|
+
declare type __ΩAlloyPluginContext = any[];
|
|
32
40
|
//#endregion
|
|
33
|
-
export { AlloyPluginContext, AlloyPluginOptions };
|
|
41
|
+
export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResolvedConfig } from "../powerlines/src/types/resolved.mjs";
|
|
2
|
+
import { UserConfig } from "../powerlines/src/types/config.mjs";
|
|
2
3
|
import { PluginContext } from "../powerlines/src/types/context.mjs";
|
|
3
4
|
import { Children, PrintTreeOptions } from "@alloy-js/core";
|
|
4
5
|
|
|
@@ -23,11 +24,18 @@ type AlloyPluginOptions = Partial<PrintTreeOptions> & {
|
|
|
23
24
|
*/
|
|
24
25
|
markdown?: boolean;
|
|
25
26
|
};
|
|
27
|
+
type AlloyPluginUserConfig = UserConfig & {
|
|
28
|
+
alloy?: AlloyPluginOptions;
|
|
29
|
+
};
|
|
26
30
|
type AlloyPluginResolvedConfig = ResolvedConfig & {
|
|
27
31
|
alloy: AlloyPluginOptions;
|
|
28
32
|
};
|
|
29
33
|
type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
30
34
|
render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
|
|
31
35
|
};
|
|
36
|
+
declare type __ΩAlloyPluginOptions = any[];
|
|
37
|
+
declare type __ΩAlloyPluginUserConfig = any[];
|
|
38
|
+
declare type __ΩAlloyPluginResolvedConfig = any[];
|
|
39
|
+
declare type __ΩAlloyPluginContext = any[];
|
|
32
40
|
//#endregion
|
|
33
|
-
export { AlloyPluginContext, AlloyPluginOptions };
|
|
41
|
+
export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig, __ΩAlloyPluginContext, __ΩAlloyPluginOptions, __ΩAlloyPluginResolvedConfig, __ΩAlloyPluginUserConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_core_contexts_context = require('../../core/contexts/context.cjs');
|
|
3
|
+
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
4
|
+
const require_typescript_components_typescript_file = require('./typescript-file.cjs');
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
7
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
9
|
+
let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
10
|
+
|
|
11
|
+
//#region src/typescript/components/builtin-file.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
14
|
+
*
|
|
15
|
+
* @param props - The properties for the source file.
|
|
16
|
+
* @returns The rendered source file component.
|
|
17
|
+
*/
|
|
18
|
+
function BuiltinFile(props) {
|
|
19
|
+
const [{ children, imports, builtinImports, id, description, tsx }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
20
|
+
"children",
|
|
21
|
+
"imports",
|
|
22
|
+
"builtinImports",
|
|
23
|
+
"id",
|
|
24
|
+
"description",
|
|
25
|
+
"tsx"
|
|
26
|
+
]);
|
|
27
|
+
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
28
|
+
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));
|
|
29
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
30
|
+
get header() {
|
|
31
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeader, {
|
|
32
|
+
get header() {
|
|
33
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocModule, {
|
|
34
|
+
name: id,
|
|
35
|
+
children: description
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
get children() {
|
|
39
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeaderImports, {
|
|
40
|
+
imports,
|
|
41
|
+
builtinImports
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
get meta() {
|
|
47
|
+
return {
|
|
48
|
+
kind: "builtin",
|
|
49
|
+
extension: tsx ? "tsx" : "ts",
|
|
50
|
+
id: (0, __stryke_path_replace.replaceExtension)(id)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}, rest, {
|
|
54
|
+
get path() {
|
|
55
|
+
return path.value;
|
|
56
|
+
},
|
|
57
|
+
children
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.BuiltinFile = BuiltinFile;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TSDocModuleProps } from "./tsdoc.cjs";
|
|
2
|
+
import { TypescriptFileProps } from "./typescript-file.cjs";
|
|
3
|
+
import * as _alloy_js_core6 from "@alloy-js/core";
|
|
4
|
+
|
|
5
|
+
//#region src/typescript/components/builtin-file.d.ts
|
|
6
|
+
type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The runtime module identifier.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This value will be included after the \`storm:\` prefix in the import statement.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The description for the builtin module.
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the file is a TSX file.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*/
|
|
23
|
+
tsx?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The properties for the source file.
|
|
29
|
+
* @returns The rendered source file component.
|
|
30
|
+
*/
|
|
31
|
+
declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core6.Children;
|
|
32
|
+
declare type __ΩBuiltinFileProps = any[];
|
|
33
|
+
//#endregion
|
|
34
|
+
export { BuiltinFile, BuiltinFileProps, __ΩBuiltinFileProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TSDocModuleProps } from "./tsdoc.mjs";
|
|
2
|
+
import { TypescriptFileProps } from "./typescript-file.mjs";
|
|
3
|
+
import * as _alloy_js_core6 from "@alloy-js/core";
|
|
4
|
+
|
|
5
|
+
//#region src/typescript/components/builtin-file.d.ts
|
|
6
|
+
type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The runtime module identifier.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This value will be included after the \`storm:\` prefix in the import statement.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The description for the builtin module.
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the file is a TSX file.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*/
|
|
23
|
+
tsx?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The properties for the source file.
|
|
29
|
+
* @returns The rendered source file component.
|
|
30
|
+
*/
|
|
31
|
+
declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core6.Children;
|
|
32
|
+
declare type __ΩBuiltinFileProps = any[];
|
|
33
|
+
//#endregion
|
|
34
|
+
export { BuiltinFile, BuiltinFileProps, __ΩBuiltinFileProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
|
+
import { TSDocModule } from "./tsdoc.mjs";
|
|
3
|
+
import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./typescript-file.mjs";
|
|
4
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { computed, splitProps } from "@alloy-js/core";
|
|
6
|
+
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
7
|
+
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
8
|
+
import { isSet } from "@stryke/type-checks/is-set";
|
|
9
|
+
|
|
10
|
+
//#region src/typescript/components/builtin-file.tsx
|
|
11
|
+
/**
|
|
12
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
13
|
+
*
|
|
14
|
+
* @param props - The properties for the source file.
|
|
15
|
+
* @returns The rendered source file component.
|
|
16
|
+
*/
|
|
17
|
+
function BuiltinFile(props) {
|
|
18
|
+
const [{ children, imports, builtinImports, id, description, tsx }, rest] = splitProps(props, [
|
|
19
|
+
"children",
|
|
20
|
+
"imports",
|
|
21
|
+
"builtinImports",
|
|
22
|
+
"id",
|
|
23
|
+
"description",
|
|
24
|
+
"tsx"
|
|
25
|
+
]);
|
|
26
|
+
const context = usePowerlinesSafe();
|
|
27
|
+
const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
28
|
+
return createComponent(TypescriptFile, mergeProps({
|
|
29
|
+
get header() {
|
|
30
|
+
return createComponent(TypescriptFileHeader, {
|
|
31
|
+
get header() {
|
|
32
|
+
return createComponent(TSDocModule, {
|
|
33
|
+
name: id,
|
|
34
|
+
children: description
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return createComponent(TypescriptFileHeaderImports, {
|
|
39
|
+
imports,
|
|
40
|
+
builtinImports
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
get meta() {
|
|
46
|
+
return {
|
|
47
|
+
kind: "builtin",
|
|
48
|
+
extension: tsx ? "tsx" : "ts",
|
|
49
|
+
id: replaceExtension(id)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, rest, {
|
|
53
|
+
get path() {
|
|
54
|
+
return path.value;
|
|
55
|
+
},
|
|
56
|
+
children
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { BuiltinFile };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
|
|
6
|
+
//#region src/typescript/components/dynamic-import-statement.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Generates a dynamic import statement for a given module path and export name.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <DynamicImportStatement importPath="./my-module" exportName="myExport" const={true} name="myVar" />
|
|
13
|
+
* // const myVar = await import("./my-module").then(m => m.myExport);
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param props - The properties for the dynamic import statement.
|
|
17
|
+
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
18
|
+
*/
|
|
19
|
+
function DynamicImportStatement(props) {
|
|
20
|
+
const { importPath, exportName = "default", const: isConst = true, ...rest } = props;
|
|
21
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, (0, __alloy_js_core_jsx_runtime.mergeProps)({ "const": isConst }, rest, { initializer: __alloy_js_core.code`await import("${importPath}").then(m => m.${exportName});` }));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.DynamicImportStatement = DynamicImportStatement;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as _alloy_js_core5 from "@alloy-js/core";
|
|
2
|
+
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
|
+
|
|
4
|
+
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
5
|
+
interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initializer"> {
|
|
6
|
+
/**
|
|
7
|
+
* The path of the module to import.
|
|
8
|
+
*/
|
|
9
|
+
importPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the export to import from the module.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue "default"
|
|
14
|
+
*/
|
|
15
|
+
exportName?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generates a dynamic import statement for a given module path and export name.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <DynamicImportStatement importPath="./my-module" exportName="myExport" const={true} name="myVar" />
|
|
23
|
+
* // const myVar = await import("./my-module").then(m => m.myExport);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param props - The properties for the dynamic import statement.
|
|
27
|
+
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
28
|
+
*/
|
|
29
|
+
declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core5.Children;
|
|
30
|
+
declare type __ΩDynamicImportStatementProps = any[];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
|