@alloy-js/core 0.19.0-dev.0 → 0.19.0-dev.12
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/CHANGELOG.md +14 -0
- package/dist/src/components/AppendFile.d.ts +90 -0
- package/dist/src/components/AppendFile.d.ts.map +1 -0
- package/dist/src/components/AppendFile.js +226 -0
- package/dist/src/components/CopyFile.d.ts +12 -0
- package/dist/src/components/CopyFile.d.ts.map +1 -0
- package/dist/src/components/CopyFile.js +15 -0
- package/dist/src/components/TemplateFile.d.ts +84 -0
- package/dist/src/components/TemplateFile.d.ts.map +1 -0
- package/dist/src/components/TemplateFile.js +133 -0
- package/dist/src/components/UpdateFile.d.ts +34 -0
- package/dist/src/components/UpdateFile.d.ts.map +1 -0
- package/dist/src/components/UpdateFile.js +66 -0
- package/dist/src/components/index.d.ts +4 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +4 -0
- package/dist/src/components/stc/index.d.ts +4 -0
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +4 -0
- package/dist/src/context/source-directory.d.ts +3 -3
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-file.d.ts +4 -0
- package/dist/src/context/source-file.d.ts.map +1 -1
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/debug.js +4 -1
- package/dist/src/host/alloy-host.browser.d.ts +11 -0
- package/dist/src/host/alloy-host.browser.d.ts.map +1 -0
- package/dist/src/host/alloy-host.browser.js +31 -0
- package/dist/src/host/alloy-host.d.ts +11 -0
- package/dist/src/host/alloy-host.d.ts.map +1 -0
- package/dist/src/host/alloy-host.js +143 -0
- package/dist/src/host/interface.d.ts +144 -0
- package/dist/src/host/interface.d.ts.map +1 -0
- package/dist/src/host/interface.js +1 -0
- package/dist/src/index.browser.d.ts +1 -1
- package/dist/src/index.browser.d.ts.map +1 -1
- package/dist/src/index.browser.js +2 -2
- package/dist/src/reactivity.js +2 -2
- package/dist/src/render.d.ts +10 -2
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +20 -1
- package/dist/src/resource.d.ts +80 -0
- package/dist/src/resource.d.ts.map +1 -0
- package/dist/src/resource.js +118 -0
- package/dist/src/scheduler.d.ts +6 -0
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +36 -0
- package/dist/src/write-output.d.ts +1 -1
- package/dist/src/write-output.d.ts.map +1 -1
- package/dist/src/write-output.js +40 -21
- package/dist/test/components/append-file.test.d.ts +2 -0
- package/dist/test/components/append-file.test.d.ts.map +1 -0
- package/dist/test/components/append-file.test.js +281 -0
- package/dist/test/components/copy-file.test.d.ts +2 -0
- package/dist/test/components/copy-file.test.d.ts.map +1 -0
- package/dist/test/components/copy-file.test.js +94 -0
- package/dist/test/components/source-file.test.d.ts.map +1 -1
- package/dist/test/components/template-file.test.d.ts +2 -0
- package/dist/test/components/template-file.test.d.ts.map +1 -0
- package/dist/test/components/template-file.test.js +133 -0
- package/dist/test/components/update-file.test.d.ts +2 -0
- package/dist/test/components/update-file.test.d.ts.map +1 -0
- package/dist/test/components/update-file.test.js +169 -0
- package/dist/test/rendering/formatting.test.d.ts.map +1 -1
- package/dist/testing/extend-expect.d.ts +0 -15
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +89 -12
- package/dist/testing/extend-expect.test.d.ts +2 -0
- package/dist/testing/extend-expect.test.d.ts.map +1 -0
- package/dist/testing/extend-expect.test.js +149 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/AppendFile.tsx +294 -0
- package/src/components/CopyFile.tsx +29 -0
- package/src/components/TemplateFile.tsx +193 -0
- package/src/components/UpdateFile.tsx +86 -0
- package/src/components/index.tsx +4 -0
- package/src/components/stc/index.ts +4 -0
- package/src/context/source-directory.ts +5 -3
- package/src/context/source-file.ts +5 -0
- package/src/debug.ts +4 -1
- package/src/host/alloy-host.browser.ts +56 -0
- package/src/host/alloy-host.ts +160 -0
- package/src/host/interface.ts +153 -0
- package/src/index.browser.ts +1 -1
- package/src/reactivity.ts +2 -2
- package/src/render.ts +44 -5
- package/src/resource.ts +152 -0
- package/src/scheduler.ts +39 -0
- package/src/write-output.ts +49 -19
- package/temp/api.json +2009 -546
- package/test/components/append-file.test.tsx +275 -0
- package/test/components/copy-file.test.tsx +98 -0
- package/test/components/source-file.test.tsx +5 -2
- package/test/components/template-file.test.tsx +127 -0
- package/test/components/update-file.test.tsx +214 -0
- package/test/rendering/formatting.test.tsx +9 -3
- package/testing/extend-expect.test.tsx +126 -0
- package/testing/extend-expect.ts +123 -23
- package/testing/vitest.d.ts +9 -1
- package/tsconfig.json +2 -1
- package/dist/src/write-output.browser.d.ts +0 -2
- package/dist/src/write-output.browser.d.ts.map +0 -1
- package/dist/src/write-output.browser.js +0 -4
- package/src/write-output.browser.ts +0 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { computed } from "@vue/reactivity";
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
import { useContext } from "../context.js";
|
|
5
|
+
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
6
|
+
import { createFileResource } from "../resource.js";
|
|
7
|
+
import { SourceFile } from "./SourceFile.js";
|
|
8
|
+
/**
|
|
9
|
+
* Props for the UpdateFile component.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A component for updating existing files or initializing new files.
|
|
14
|
+
*
|
|
15
|
+
* This component allows you to read the current contents of a file and generate
|
|
16
|
+
* new content based on those contents. If the file doesn't exist, it can use
|
|
17
|
+
* default content from either a file path or inline content.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <UpdateFile path="config.json" defaultContent="{}">
|
|
22
|
+
* {(currentContents) => {
|
|
23
|
+
* const config = currentContents ? JSON.parse(currentContents) : {};
|
|
24
|
+
* config.newProperty = "value";
|
|
25
|
+
* return JSON.stringify(config, null, 2);
|
|
26
|
+
* }}
|
|
27
|
+
* </UpdateFile>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function UpdateFile(props) {
|
|
31
|
+
const parentDirectory = useContext(SourceDirectoryContext);
|
|
32
|
+
const fullPath = join(parentDirectory ? parentDirectory.path : "", props.path);
|
|
33
|
+
const fileResource = createFileResource(fullPath);
|
|
34
|
+
const newContent = computed(() => {
|
|
35
|
+
if (fileResource.loading) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (fileResource.error) {
|
|
39
|
+
if (fileResource.error.code === "ENOENT") {
|
|
40
|
+
if ("defaultContentPath" in props) {
|
|
41
|
+
const defaultContentResource = createFileResource(props.defaultContentPath);
|
|
42
|
+
return computed(() => {
|
|
43
|
+
if (defaultContentResource.loading) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (defaultContentResource.error) {
|
|
47
|
+
throw defaultContentResource.error;
|
|
48
|
+
}
|
|
49
|
+
return props.children(defaultContentResource.data);
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
return props.children(null);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw fileResource.error;
|
|
56
|
+
}
|
|
57
|
+
return props.children(fileResource.data);
|
|
58
|
+
});
|
|
59
|
+
return _$createComponent(SourceFile, {
|
|
60
|
+
get path() {
|
|
61
|
+
return props.path;
|
|
62
|
+
},
|
|
63
|
+
filetype: "text/plain",
|
|
64
|
+
children: newContent
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./AppendFile.jsx";
|
|
1
2
|
export * from "./Block.js";
|
|
3
|
+
export * from "./CopyFile.jsx";
|
|
2
4
|
export * from "./Declaration.js";
|
|
3
5
|
export * from "./For.js";
|
|
4
6
|
export * from "./Indent.jsx";
|
|
@@ -16,5 +18,7 @@ export * from "./SourceDirectory.js";
|
|
|
16
18
|
export * from "./SourceFile.js";
|
|
17
19
|
export * from "./StatementList.jsx";
|
|
18
20
|
export * from "./Switch.jsx";
|
|
21
|
+
export * from "./TemplateFile.jsx";
|
|
22
|
+
export * from "./UpdateFile.jsx";
|
|
19
23
|
export * from "./Wrap.jsx";
|
|
20
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./AppendFile.js";
|
|
1
2
|
export * from "./Block.js";
|
|
3
|
+
export * from "./CopyFile.js";
|
|
2
4
|
export * from "./Declaration.js";
|
|
3
5
|
export * from "./For.js";
|
|
4
6
|
export * from "./Indent.js";
|
|
@@ -16,4 +18,6 @@ export * from "./SourceDirectory.js";
|
|
|
16
18
|
export * from "./SourceFile.js";
|
|
17
19
|
export * from "./StatementList.js";
|
|
18
20
|
export * from "./Switch.js";
|
|
21
|
+
export * from "./TemplateFile.js";
|
|
22
|
+
export * from "./UpdateFile.js";
|
|
19
23
|
export * from "./Wrap.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as base from "../index.js";
|
|
2
|
+
export declare const AppendFile: import("../../stc.js").StcSignature<base.AppendFileProps>;
|
|
2
3
|
export declare const Block: import("../../stc.js").StcSignature<base.BlockProps>;
|
|
4
|
+
export declare const CopyFile: import("../../stc.js").StcSignature<base.CopyFileProps>;
|
|
3
5
|
export declare const Declaration: import("../../stc.js").StcSignature<base.DeclarationProps>;
|
|
4
6
|
export declare const For: <T extends base.ForSupportedCollections | (() => base.ForSupportedCollections) | import("@vue/reactivity").Ref<base.ForSupportedCollections>, U extends import("@alloy-js/core/jsx-runtime").Children>(props: Omit<base.ForProps<T, U>, "children"> & Partial<Pick<base.ForProps<T, U>, "children">>) => import("../../stc.js").StcComponentCreator<base.ForProps<T, U>>;
|
|
5
7
|
export declare const Indent: import("../../stc.js").StcSignature<base.IndentProps>;
|
|
@@ -16,6 +18,8 @@ export declare const StatementList: import("../../stc.js").StcSignature<base.Sta
|
|
|
16
18
|
export declare const SourceDirectory: import("../../stc.js").StcSignature<base.SourceDirectoryProps>;
|
|
17
19
|
export declare const SourceFile: import("../../stc.js").StcSignature<base.SourceFileProps>;
|
|
18
20
|
export declare const Switch: import("../../stc.js").StcSignature<base.SwitchProps>;
|
|
21
|
+
export declare const TemplateFile: import("../../stc.js").StcSignature<base.TemplateFileProps>;
|
|
22
|
+
export declare const UpdateFile: import("../../stc.js").StcSignature<base.UpdateFileProps>;
|
|
19
23
|
export declare const Wrap: <TProps>(props: Omit<base.WrapProps<TProps>, "children"> & Partial<Pick<base.WrapProps<TProps>, "children">>) => import("../../stc.js").StcComponentCreator<base.WrapProps<TProps>>;
|
|
20
24
|
export declare const ReferenceOrContent: import("../../stc.js").StcSignature<base.ReferenceOrContentProps>;
|
|
21
25
|
export * from "./sti.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,KAAK,sDAAkB,CAAC;AACrC,eAAO,MAAM,WAAW,4DAAwB,CAAC;AACjD,eAAO,MAAM,GAAG,0WAAgB,CAAC;AACjC,eAAO,MAAM,MAAM,uDAAmB,CAAC;AACvC,eAAO,MAAM,IAAI,qDAAiB,CAAC;AACnC,eAAO,MAAM,iBAAiB,kEAA8B,CAAC;AAC7D,eAAO,MAAM,UAAU,yCAAuB,CAAC;AAC/C,eAAO,MAAM,WAAW,4DAAwB,CAAC;AACjD,eAAO,MAAM,IAAI,yCAAiB,CAAC;AACnC,eAAO,MAAM,MAAM,uDAAmB,CAAC;AACvC,eAAO,MAAM,KAAK,iDAAkB,CAAC;AACrC,eAAO,MAAM,KAAK,sDAAkB,CAAC;AACrC,eAAO,MAAM,IAAI,qDAAiB,CAAC;AACnC,eA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AC;AACnC,eAAO,MAAM,kBAAkB,mEAA+B,CAAC;AAE/D,cAAc,UAAU,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { stc } from "../../stc.js";
|
|
2
2
|
import * as base from "../index.js";
|
|
3
|
+
export const AppendFile = stc(base.AppendFile);
|
|
3
4
|
export const Block = stc(base.Block);
|
|
5
|
+
export const CopyFile = stc(base.CopyFile);
|
|
4
6
|
export const Declaration = stc(base.Declaration);
|
|
5
7
|
export const For = stc(base.For);
|
|
6
8
|
export const Indent = stc(base.Indent);
|
|
@@ -17,6 +19,8 @@ export const StatementList = stc(base.StatementList);
|
|
|
17
19
|
export const SourceDirectory = stc(base.SourceDirectory);
|
|
18
20
|
export const SourceFile = stc(base.SourceFile);
|
|
19
21
|
export const Switch = stc(base.Switch);
|
|
22
|
+
export const TemplateFile = stc(base.TemplateFile);
|
|
23
|
+
export const UpdateFile = stc(base.UpdateFile);
|
|
20
24
|
export const Wrap = stc(base.Wrap);
|
|
21
25
|
export const ReferenceOrContent = stc(base.ReferenceOrContent);
|
|
22
26
|
export * from "./sti.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentContext } from "../context.js";
|
|
2
|
-
import type { SourceFileContext } from "./source-file.js";
|
|
2
|
+
import type { CopyFileContext, SourceFileContext } from "./source-file.js";
|
|
3
3
|
export interface SourceDirectoryContext {
|
|
4
|
-
contents: (SourceDirectoryContext | SourceFileContext)[];
|
|
5
|
-
addContent(content: SourceDirectoryContext | SourceFileContext): void;
|
|
4
|
+
contents: (SourceDirectoryContext | SourceFileContext | CopyFileContext)[];
|
|
5
|
+
addContent(content: SourceDirectoryContext | SourceFileContext | CopyFileContext): void;
|
|
6
6
|
path: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const SourceDirectoryContext: ComponentContext<SourceDirectoryContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-directory.d.ts","sourceRoot":"","sources":["../../../src/context/source-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"source-directory.d.ts","sourceRoot":"","sources":["../../../src/context/source-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,sBAAsB,GAAG,iBAAiB,GAAG,eAAe,CAAC,EAAE,CAAC;IAC3E,UAAU,CACR,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,GAAG,eAAe,GACpE,IAAI,CAAC;IACR,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,sBAAsB,CACrC,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ComponentContext } from "../context.js";
|
|
2
2
|
import type { Refkey } from "../refkey.js";
|
|
3
3
|
import { ComponentDefinition } from "../runtime/component.js";
|
|
4
|
+
export interface CopyFileContext {
|
|
5
|
+
path: string;
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
}
|
|
4
8
|
export interface SourceFileContext {
|
|
5
9
|
path: string;
|
|
6
10
|
filetype: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../../src/context/source-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,CAChC,CAAC"}
|
|
1
|
+
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../../src/context/source-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,CAChC,CAAC"}
|
package/dist/src/debug.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAMA,UAAU,cAAc;IACtB,SAAS,EAAE;QACT,KAAK,IAAI,IAAI,CAAC;QACd,IAAI,IAAI,IAAI,CAAC;QACb,KAAK,IAAI,IAAI,CAAC;QACd,MAAM,IAAI,IAAI,CAAC;QACf,OAAO,IAAI,IAAI,CAAC;KACjB,CAAC;CACH;AAwGD,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,KAAK,EAAE,cAAc,CAAC;CAC3B;AA4FD,wBAAgB,WAAW,YAE1B"}
|
package/dist/src/debug.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import { isReactive } from "@vue/reactivity";
|
|
3
2
|
import Table from "cli-table3";
|
|
4
3
|
import pc from "picocolors";
|
|
@@ -8,12 +7,15 @@ const debug = {
|
|
|
8
7
|
component: {
|
|
9
8
|
stack: debugStack,
|
|
10
9
|
tree() {
|
|
10
|
+
//eslint-disable-next-line no-console
|
|
11
11
|
console.log("tree");
|
|
12
12
|
},
|
|
13
13
|
watch() {
|
|
14
|
+
//eslint-disable-next-line no-console
|
|
14
15
|
console.log("watch");
|
|
15
16
|
},
|
|
16
17
|
render() {
|
|
18
|
+
//eslint-disable-next-line no-console
|
|
17
19
|
console.log("render");
|
|
18
20
|
},
|
|
19
21
|
context: debugContext
|
|
@@ -47,6 +49,7 @@ function debugStack() {
|
|
|
47
49
|
function debugContext() {
|
|
48
50
|
let currentContext = getContext();
|
|
49
51
|
while (currentContext !== null) {
|
|
52
|
+
//eslint-disable-next-line no-console
|
|
50
53
|
console.log(printContext(currentContext));
|
|
51
54
|
currentContext = currentContext.owner;
|
|
52
55
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AlloyFileInterface, AlloyHostInterface } from "./interface.js";
|
|
2
|
+
export declare const AlloyHost: AlloyHostInterface;
|
|
3
|
+
export declare class AlloyFile implements AlloyFileInterface {
|
|
4
|
+
private source;
|
|
5
|
+
constructor(source: string);
|
|
6
|
+
text(): Promise<string>;
|
|
7
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
8
|
+
bytes(): Promise<Uint8Array>;
|
|
9
|
+
stream(): ReadableStream<Uint8Array>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=alloy-host.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alloy-host.browser.d.ts","sourceRoot":"","sources":["../../../src/host/alloy-host.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExE,eAAO,MAAM,SAAS,EAAE,kBAyBvB,CAAC;AAEF,qBAAa,SAAU,YAAW,kBAAkB;IACtC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAMvB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAMnC,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC;IAMlC,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC;CAKrC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const AlloyHost = {
|
|
2
|
+
read(source) {
|
|
3
|
+
return new AlloyFile(source);
|
|
4
|
+
},
|
|
5
|
+
async write(destination, content) {
|
|
6
|
+
throw new Error("File system write operations are not supported in the browser");
|
|
7
|
+
},
|
|
8
|
+
async exists(source) {
|
|
9
|
+
throw new Error("File system exists operations are not supported in the browser");
|
|
10
|
+
},
|
|
11
|
+
async mkdir(path) {
|
|
12
|
+
throw new Error("File system mkdir operations are not supported in the browser");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export class AlloyFile {
|
|
16
|
+
constructor(source) {
|
|
17
|
+
this.source = source;
|
|
18
|
+
}
|
|
19
|
+
async text() {
|
|
20
|
+
throw new Error("File system read operations are not supported in the browser");
|
|
21
|
+
}
|
|
22
|
+
async arrayBuffer() {
|
|
23
|
+
throw new Error("File system read operations are not supported in the browser");
|
|
24
|
+
}
|
|
25
|
+
async bytes() {
|
|
26
|
+
throw new Error("File system read operations are not supported in the browser");
|
|
27
|
+
}
|
|
28
|
+
stream() {
|
|
29
|
+
throw new Error("File system read operations are not supported in the browser");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AlloyFileInterface, AlloyHostInterface } from "./interface.js";
|
|
2
|
+
export declare const AlloyHost: AlloyHostInterface;
|
|
3
|
+
export declare class AlloyFile implements AlloyFileInterface {
|
|
4
|
+
private source;
|
|
5
|
+
constructor(source: string);
|
|
6
|
+
text(): Promise<string>;
|
|
7
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
8
|
+
bytes(): Promise<Uint8Array>;
|
|
9
|
+
stream(): ReadableStream<Uint8Array>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=alloy-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alloy-host.d.ts","sourceRoot":"","sources":["../../../src/host/alloy-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAExE,eAAO,MAAM,SAAS,EAAE,kBAsFvB,CAAC;AAEF,qBAAa,SAAU,YAAW,kBAAkB;IACtC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAUvB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAcnC,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC;IAWlC,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC;CA6BrC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createReadStream, createWriteStream } from "fs";
|
|
2
|
+
import { access, mkdir, readFile, writeFile } from "fs/promises";
|
|
3
|
+
export const AlloyHost = {
|
|
4
|
+
read(source) {
|
|
5
|
+
return new AlloyFile(source);
|
|
6
|
+
},
|
|
7
|
+
async write(destination, content) {
|
|
8
|
+
if (typeof content === "string") {
|
|
9
|
+
//eslint-disable-next-line no-useless-catch
|
|
10
|
+
try {
|
|
11
|
+
await writeFile(destination, content, "utf8");
|
|
12
|
+
} catch (e) {
|
|
13
|
+
// get good callstacks
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
} else if (content instanceof ArrayBuffer) {
|
|
17
|
+
//eslint-disable-next-line no-useless-catch
|
|
18
|
+
try {
|
|
19
|
+
await writeFile(destination, new Uint8Array(content));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// get good callstacks
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
} else if (content instanceof Uint8Array) {
|
|
25
|
+
//eslint-disable-next-line no-useless-catch
|
|
26
|
+
try {
|
|
27
|
+
await writeFile(destination, content);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// get good callstacks
|
|
30
|
+
throw e;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
// content is ReadableStream<Uint8Array>
|
|
34
|
+
//eslint-disable-next-line no-useless-catch
|
|
35
|
+
try {
|
|
36
|
+
const writeStream = createWriteStream(destination);
|
|
37
|
+
const reader = content.getReader();
|
|
38
|
+
try {
|
|
39
|
+
while (true) {
|
|
40
|
+
const {
|
|
41
|
+
done,
|
|
42
|
+
value
|
|
43
|
+
} = await reader.read();
|
|
44
|
+
if (done) break;
|
|
45
|
+
await new Promise((resolve, reject) => {
|
|
46
|
+
writeStream.write(value, err => {
|
|
47
|
+
if (err) reject(err);else resolve();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
} finally {
|
|
52
|
+
reader.releaseLock();
|
|
53
|
+
await new Promise((resolve, reject) => {
|
|
54
|
+
writeStream.end(err => {
|
|
55
|
+
if (err) reject(err);else resolve();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// get good callstacks
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
async exists(source) {
|
|
66
|
+
try {
|
|
67
|
+
await access(source);
|
|
68
|
+
return true;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
async mkdir(path) {
|
|
74
|
+
//eslint-disable-next-line no-useless-catch
|
|
75
|
+
try {
|
|
76
|
+
await mkdir(path, {
|
|
77
|
+
recursive: true
|
|
78
|
+
});
|
|
79
|
+
} catch (e) {
|
|
80
|
+
// get good callstacks
|
|
81
|
+
throw e;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export class AlloyFile {
|
|
86
|
+
constructor(source) {
|
|
87
|
+
this.source = source;
|
|
88
|
+
}
|
|
89
|
+
async text() {
|
|
90
|
+
//eslint-disable-next-line no-useless-catch
|
|
91
|
+
try {
|
|
92
|
+
return await readFile(this.source, "utf8");
|
|
93
|
+
} catch (e) {
|
|
94
|
+
// get good callstacks
|
|
95
|
+
throw e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async arrayBuffer() {
|
|
99
|
+
//eslint-disable-next-line no-useless-catch
|
|
100
|
+
try {
|
|
101
|
+
const buffer = await readFile(this.source);
|
|
102
|
+
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
// get good callstacks
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async bytes() {
|
|
109
|
+
//eslint-disable-next-line no-useless-catch
|
|
110
|
+
try {
|
|
111
|
+
const buffer = await readFile(this.source);
|
|
112
|
+
return new Uint8Array(buffer);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
// get good callstacks
|
|
115
|
+
throw e;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
stream() {
|
|
119
|
+
//eslint-disable-next-line no-useless-catch
|
|
120
|
+
try {
|
|
121
|
+
const nodeStream = createReadStream(this.source);
|
|
122
|
+
return new ReadableStream({
|
|
123
|
+
start(controller) {
|
|
124
|
+
nodeStream.on("data", chunk => {
|
|
125
|
+
controller.enqueue(new Uint8Array(chunk));
|
|
126
|
+
});
|
|
127
|
+
nodeStream.on("end", () => {
|
|
128
|
+
controller.close();
|
|
129
|
+
});
|
|
130
|
+
nodeStream.on("error", err => {
|
|
131
|
+
controller.error(err);
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
cancel() {
|
|
135
|
+
nodeStream.destroy();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} catch (e) {
|
|
139
|
+
// get good callstacks
|
|
140
|
+
throw e;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for the Alloy host file system operations.
|
|
3
|
+
*
|
|
4
|
+
* This interface abstracts file system operations to allow different
|
|
5
|
+
* implementations across different environments (Node.js, browser, etc.).
|
|
6
|
+
*/
|
|
7
|
+
export interface AlloyHostInterface {
|
|
8
|
+
/**
|
|
9
|
+
* Read a file from the file system.
|
|
10
|
+
*
|
|
11
|
+
* @param source - The path to the file to read
|
|
12
|
+
* @returns An AlloyFileInterface for accessing the file content in different formats
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const file = AlloyHost.read('./config.json');
|
|
17
|
+
* const content = await file.text();
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
read(source: string): AlloyFileInterface;
|
|
21
|
+
/**
|
|
22
|
+
* Write content to a file in the file system.
|
|
23
|
+
*
|
|
24
|
+
* Supports writing different types of content including strings, binary data,
|
|
25
|
+
* and streams. For strings, content is written with UTF-8 encoding.
|
|
26
|
+
*
|
|
27
|
+
* @param destination - The path where the file should be written
|
|
28
|
+
* @param content - The content to write (string, ArrayBuffer, Uint8Array, or ReadableStream)
|
|
29
|
+
* @returns A Promise that resolves when the write operation is complete
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Write a string
|
|
34
|
+
* await AlloyHost.write('./output.txt', 'Hello, world!');
|
|
35
|
+
*
|
|
36
|
+
* // Write binary data
|
|
37
|
+
* const data = new Uint8Array([72, 101, 108, 108, 111]);
|
|
38
|
+
* await AlloyHost.write('./binary.dat', data);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
write(destination: string, content: string | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array>): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a file or directory exists at the given path.
|
|
44
|
+
*
|
|
45
|
+
* @param source - The path to check for existence
|
|
46
|
+
* @returns A Promise that resolves to true if the path exists, false otherwise
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const fileExists = await AlloyHost.exists('./config.json');
|
|
51
|
+
* if (fileExists) {
|
|
52
|
+
* // File exists, safe to read
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
exists(source: string): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a directory at the specified path.
|
|
59
|
+
*
|
|
60
|
+
* Creates the directory and any necessary parent directories recursively.
|
|
61
|
+
* If the directory already exists, this operation succeeds without error.
|
|
62
|
+
*
|
|
63
|
+
* @param path - The path of the directory to create
|
|
64
|
+
* @returns A Promise that resolves when the directory creation is complete
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* await AlloyHost.mkdir('./output/nested/directory');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
mkdir(path: string): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Interface for reading file content in different formats.
|
|
75
|
+
*
|
|
76
|
+
* This interface provides multiple ways to access the same file content,
|
|
77
|
+
* allowing consumers to choose the most appropriate format for their use case.
|
|
78
|
+
*/
|
|
79
|
+
export interface AlloyFileInterface {
|
|
80
|
+
/**
|
|
81
|
+
* Read the file content as a UTF-8 encoded string.
|
|
82
|
+
*
|
|
83
|
+
* @returns A Promise that resolves to the file content as a string
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const file = AlloyHost.read('./config.json');
|
|
88
|
+
* const jsonString = await file.text();
|
|
89
|
+
* const config = JSON.parse(jsonString);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
text(): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Read the file content as an ArrayBuffer.
|
|
95
|
+
*
|
|
96
|
+
* Useful for working with binary data or when you need a raw buffer
|
|
97
|
+
* that can be used with various JavaScript APIs.
|
|
98
|
+
*
|
|
99
|
+
* @returns A Promise that resolves to the file content as an ArrayBuffer
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const file = AlloyHost.read('./image.png');
|
|
104
|
+
* const buffer = await file.arrayBuffer();
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
108
|
+
/**
|
|
109
|
+
* Read the file content as a Uint8Array.
|
|
110
|
+
*
|
|
111
|
+
* Convenient for working with binary data when you need direct access
|
|
112
|
+
* to individual bytes.
|
|
113
|
+
*
|
|
114
|
+
* @returns A Promise that resolves to the file content as a Uint8Array
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const file = AlloyHost.read('./binary.dat');
|
|
119
|
+
* const bytes = await file.bytes();
|
|
120
|
+
* console.log('First byte:', bytes[0]);
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
bytes(): Promise<Uint8Array>;
|
|
124
|
+
/**
|
|
125
|
+
* Get a readable stream of the file content.
|
|
126
|
+
*
|
|
127
|
+
* Useful for processing large files without loading the entire content
|
|
128
|
+
* into memory at once, or for piping data to other streams.
|
|
129
|
+
*
|
|
130
|
+
* @returns A ReadableStream that yields Uint8Array chunks of the file content
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const file = AlloyHost.read('./large-file.dat');
|
|
135
|
+
* const stream = file.stream();
|
|
136
|
+
*
|
|
137
|
+
* for await (const chunk of stream) {
|
|
138
|
+
* console.log('Received chunk:', chunk);
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
stream(): ReadableStream<Uint8Array>;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/host/interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CACH,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,GACtE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAExB;;;;;;;;;;;;;OAaG;IACH,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAEpC;;;;;;;;;;;;;;OAcG;IACH,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE7B;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,YAAY,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export
|
|
1
|
+
export * from "./host/alloy-host.browser.js"; // Override writeOutput for browsers
|
|
2
|
+
export * from "./index.js"; // Re-export everything
|
package/dist/src/reactivity.js
CHANGED
|
@@ -84,12 +84,12 @@ export function effect(fn, current) {
|
|
|
84
84
|
scheduler: scheduler(() => runner),
|
|
85
85
|
onTrack(event) {
|
|
86
86
|
trace(TracePhase.effect.track, () => {
|
|
87
|
-
return `tracking ${event.target}, ${event.key}`;
|
|
87
|
+
return `tracking ${event.target}, ${String(event.key)}`;
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
90
|
onTrigger(event) {
|
|
91
91
|
trace(TracePhase.effect.trigger, () => {
|
|
92
|
-
return `triggering ${event.target}, ${event.key}`;
|
|
92
|
+
return `triggering ${event.target}, ${String(event.key)}`;
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
});
|
package/dist/src/render.d.ts
CHANGED
|
@@ -85,12 +85,18 @@ export interface OutputDirectory {
|
|
|
85
85
|
path: string;
|
|
86
86
|
contents: (OutputDirectory | OutputFile)[];
|
|
87
87
|
}
|
|
88
|
-
export interface
|
|
88
|
+
export interface OutputFileBase {
|
|
89
89
|
kind: "file";
|
|
90
|
-
contents: string;
|
|
91
90
|
path: string;
|
|
91
|
+
}
|
|
92
|
+
export interface CopyOutputFile extends OutputFileBase {
|
|
93
|
+
sourcePath: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ContentOutputFile extends OutputFileBase {
|
|
96
|
+
contents: string;
|
|
92
97
|
filetype: string;
|
|
93
98
|
}
|
|
99
|
+
export type OutputFile = ContentOutputFile | CopyOutputFile;
|
|
94
100
|
export declare function getContextForRenderNode(node: RenderedTextTree): Context | undefined;
|
|
95
101
|
export declare const printHookTag: unique symbol;
|
|
96
102
|
export interface PrintHook {
|
|
@@ -103,6 +109,8 @@ export declare function createRenderTreeHook(subtree: RenderedTextTree, hooks: O
|
|
|
103
109
|
export declare function isPrintHook(type: unknown): type is PrintHook;
|
|
104
110
|
export type RenderedTextTree = (string | RenderedTextTree | PrintHook)[];
|
|
105
111
|
export declare function render(children: Children, options?: PrintTreeOptions): OutputDirectory;
|
|
112
|
+
export declare function renderAsync(children: Children, options?: PrintTreeOptions): Promise<OutputDirectory>;
|
|
113
|
+
export declare function sourceFilesForTree(tree: RenderedTextTree, options?: PrintTreeOptions): OutputDirectory;
|
|
106
114
|
export declare function renderTree(children: Children): RenderedTextTree;
|
|
107
115
|
export interface PrintTreeOptions {
|
|
108
116
|
/**
|
package/dist/src/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAO,MAAM,UAAU,CAAC;AAKpC,OAAO,EACL,OAAO,EAQR,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,QAAQ,EACR,SAAS,EAET,KAAK,EACN,MAAM,wBAAwB,CAAC;AA0BhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,eAAe,GAAG,UAAU,CAAC,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/render.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,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