@alloy-js/core 0.3.0 → 0.5.0
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 +20 -0
- package/dist/src/binder.d.ts +43 -18
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +120 -16
- package/dist/src/binder.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/Indent.d.ts +2 -2
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/Indent.js.map +1 -1
- package/dist/src/components/MemberDeclaration.d.ts +2 -2
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js.map +1 -1
- package/dist/src/components/MemberName.d.ts +1 -1
- package/dist/src/components/MemberName.d.ts.map +1 -1
- package/dist/src/components/MemberScope.d.ts +2 -2
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/Name.d.ts +1 -1
- package/dist/src/components/Name.d.ts.map +1 -1
- package/dist/src/components/Output.d.ts +2 -2
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +6 -2
- package/dist/src/components/Output.js.map +1 -1
- package/dist/src/components/Scope.d.ts +2 -2
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts +3 -3
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js +1 -1
- package/dist/src/components/SourceDirectory.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +3 -3
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +1 -1
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +18 -18
- package/dist/src/context/assignment.d.ts.map +1 -1
- package/dist/src/context/assignment.js +2 -2
- package/dist/src/context/assignment.js.map +1 -1
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/binder.js +2 -2
- package/dist/src/context/binder.js.map +1 -1
- package/dist/src/context/declaration.d.ts.map +1 -1
- package/dist/src/context/declaration.js +2 -2
- package/dist/src/context/declaration.js.map +1 -1
- package/dist/src/context/indent.d.ts.map +1 -1
- package/dist/src/context/indent.js +2 -2
- package/dist/src/context/indent.js.map +1 -1
- package/dist/src/context/member-declaration.d.ts +1 -0
- package/dist/src/context/member-declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.js +5 -2
- package/dist/src/context/member-declaration.js.map +1 -1
- package/dist/src/context/member-scope.d.ts.map +1 -1
- package/dist/src/context/member-scope.js +2 -2
- package/dist/src/context/member-scope.js.map +1 -1
- package/dist/src/context/name-policy.d.ts.map +1 -1
- package/dist/src/context/name-policy.js +2 -2
- package/dist/src/context/name-policy.js.map +1 -1
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/scope.js +2 -2
- package/dist/src/context/scope.js.map +1 -1
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-directory.js +2 -2
- package/dist/src/context/source-directory.js.map +1 -1
- package/dist/src/context/source-file.d.ts.map +1 -1
- package/dist/src/context/source-file.js +2 -2
- package/dist/src/context/source-file.js.map +1 -1
- package/dist/src/context.d.ts +5 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +11 -4
- package/dist/src/context.js.map +1 -1
- package/dist/src/debug.d.ts +14 -0
- package/dist/src/debug.d.ts.map +1 -0
- package/dist/src/debug.js +163 -0
- package/dist/src/debug.js.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/jsx-runtime.d.ts +27 -4
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +20 -7
- package/dist/src/jsx-runtime.js.map +1 -1
- package/dist/src/render.d.ts +1 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +15 -13
- package/dist/src/render.js.map +1 -1
- package/dist/src/slot.d.ts +15 -0
- package/dist/src/slot.d.ts.map +1 -0
- package/dist/src/slot.js +51 -0
- package/dist/src/slot.js.map +1 -0
- package/dist/src/tap.d.ts +19 -0
- package/dist/src/tap.d.ts.map +1 -0
- package/dist/src/tap.js +39 -0
- package/dist/src/tap.js.map +1 -0
- package/dist/src/utils.d.ts +1 -6
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -34
- package/dist/src/utils.js.map +1 -1
- package/dist/src/write-output.browser.d.ts +2 -0
- package/dist/src/write-output.browser.d.ts.map +1 -0
- package/dist/src/write-output.browser.js +4 -0
- package/dist/src/write-output.browser.js.map +1 -0
- package/dist/src/write-output.d.ts +7 -0
- package/dist/src/write-output.d.ts.map +1 -0
- package/dist/src/write-output.js +34 -0
- package/dist/src/write-output.js.map +1 -0
- package/dist/test/components/slot.test.d.ts +2 -0
- package/dist/test/components/slot.test.d.ts.map +1 -0
- package/dist/testing/render.d.ts +1 -1
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -6
- package/src/binder.ts +214 -50
- package/src/components/Declaration.tsx +1 -1
- package/src/components/Indent.tsx +1 -1
- package/src/components/MemberDeclaration.tsx +1 -1
- package/src/components/MemberScope.tsx +1 -1
- package/src/components/Output.tsx +4 -2
- package/src/components/Scope.tsx +1 -1
- package/src/components/SourceDirectory.tsx +2 -2
- package/src/components/SourceFile.tsx +2 -6
- package/src/context/assignment.ts +6 -2
- package/src/context/binder.ts +7 -2
- package/src/context/declaration.ts +2 -2
- package/src/context/indent.ts +13 -6
- package/src/context/member-declaration.ts +10 -2
- package/src/context/member-scope.ts +6 -2
- package/src/context/name-policy.ts +6 -2
- package/src/context/scope.ts +7 -2
- package/src/context/source-directory.ts +2 -2
- package/src/context/source-file.ts +2 -2
- package/src/context.ts +15 -4
- package/src/debug.ts +209 -0
- package/src/index.ts +3 -1
- package/src/jsx-runtime.ts +46 -11
- package/src/render.ts +21 -19
- package/src/slot.ts +90 -0
- package/src/tap.ts +69 -0
- package/src/utils.ts +2 -34
- package/src/write-output.browser.ts +3 -0
- package/src/write-output.ts +33 -0
- package/temp/api.json +1848 -203
- package/test/components/slot.test.tsx +172 -0
- package/test/rendering/basic.test.tsx +1 -1
- package/test/symbols.test.ts +161 -3
- package/testing/render.ts +1 -1
package/src/utils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { code } from "./code.js";
|
|
1
2
|
import {
|
|
2
3
|
Child,
|
|
3
4
|
Children,
|
|
@@ -5,10 +6,7 @@ import {
|
|
|
5
6
|
ComponentDefinition,
|
|
6
7
|
isComponentCreator,
|
|
7
8
|
memo,
|
|
8
|
-
} from "
|
|
9
|
-
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
10
|
-
import { relative, resolve } from "pathe";
|
|
11
|
-
import { code } from "./code.js";
|
|
9
|
+
} from "./jsx-runtime.js";
|
|
12
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
11
|
import { OutputDirectory, OutputFile, render } from "./render.js";
|
|
14
12
|
|
|
@@ -256,33 +254,3 @@ export function traverseOutput(
|
|
|
256
254
|
}
|
|
257
255
|
}
|
|
258
256
|
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Write the output from {@link render} to the file system.
|
|
262
|
-
*
|
|
263
|
-
*/
|
|
264
|
-
export function writeOutput(output: OutputDirectory, basePath: string = "") {
|
|
265
|
-
traverseOutput(output, {
|
|
266
|
-
visitDirectory(directory) {
|
|
267
|
-
const path = resolve(basePath, directory.path);
|
|
268
|
-
if (statSync(path)) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
// eslint-disable-next-line no-console
|
|
272
|
-
console.log("create", relative(process.cwd(), path));
|
|
273
|
-
mkdirSync(path, { recursive: true });
|
|
274
|
-
},
|
|
275
|
-
visitFile(file) {
|
|
276
|
-
const path = resolve(basePath, file.path);
|
|
277
|
-
if (statSync(path)) {
|
|
278
|
-
// eslint-disable-next-line no-console
|
|
279
|
-
console.log("overwrite", relative(process.cwd(), path));
|
|
280
|
-
} else {
|
|
281
|
-
// eslint-disable-next-line no-console
|
|
282
|
-
console.log("create", relative(process.cwd(), path));
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
writeFileSync(path, file.contents);
|
|
286
|
-
},
|
|
287
|
-
});
|
|
288
|
-
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { relative, resolve } from "pathe";
|
|
3
|
+
import { OutputDirectory } from "./render.js";
|
|
4
|
+
import { traverseOutput } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Write the output from {@link render} to the file system.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export function writeOutput(output: OutputDirectory, basePath: string = "") {
|
|
10
|
+
traverseOutput(output, {
|
|
11
|
+
visitDirectory(directory) {
|
|
12
|
+
const path = resolve(basePath, directory.path);
|
|
13
|
+
if (statSync(path)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.log("create", relative(process.cwd(), path));
|
|
18
|
+
mkdirSync(path, { recursive: true });
|
|
19
|
+
},
|
|
20
|
+
visitFile(file) {
|
|
21
|
+
const path = resolve(basePath, file.path);
|
|
22
|
+
if (statSync(path)) {
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.log("overwrite", relative(process.cwd(), path));
|
|
25
|
+
} else {
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log("create", relative(process.cwd(), path));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
writeFileSync(path, file.contents);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|