@alloy-js/core 0.4.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 +9 -0
- package/dist/src/binder.d.ts +15 -13
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +19 -15
- package/dist/src/binder.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Indent.d.ts +1 -1
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.d.ts +1 -1
- package/dist/src/components/MemberDeclaration.d.ts.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 +1 -1
- 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 +1 -1
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +3 -1
- package/dist/src/components/Output.js.map +1 -1
- package/dist/src/components/Scope.d.ts +1 -1
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts +2 -2
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceFile.d.ts +2 -2
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/stc/index.d.ts +18 -18
- 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 +4 -1
- package/dist/src/context/member-declaration.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/jsx-runtime.d.ts +21 -2
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +12 -1
- package/dist/src/jsx-runtime.js.map +1 -1
- package/dist/src/render.js +12 -10
- package/dist/src/render.js.map +1 -1
- 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 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/binder.ts +39 -50
- package/src/components/Output.tsx +2 -1
- package/src/components/SourceDirectory.tsx +1 -1
- package/src/components/SourceFile.tsx +1 -1
- package/src/context/member-declaration.ts +9 -1
- package/src/index.ts +1 -0
- package/src/jsx-runtime.ts +27 -3
- package/src/render.ts +13 -11
- package/src/tap.ts +69 -0
- package/temp/api.json +1364 -225
- package/test/symbols.test.ts +59 -3
package/test/symbols.test.ts
CHANGED
|
@@ -20,7 +20,6 @@ it("works", () => {
|
|
|
20
20
|
const symbol = binder.createSymbol({
|
|
21
21
|
name: "sym",
|
|
22
22
|
scope,
|
|
23
|
-
refkey: "foo",
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
expect([...scope.getSymbolNames()]).toEqual(["sym"]);
|
|
@@ -41,13 +40,11 @@ it("resolves symbol conflicts", () => {
|
|
|
41
40
|
const _s1 = binder.createSymbol({
|
|
42
41
|
name: "sym",
|
|
43
42
|
scope,
|
|
44
|
-
refkey: "foo",
|
|
45
43
|
});
|
|
46
44
|
|
|
47
45
|
const s2 = binder.createSymbol({
|
|
48
46
|
name: "sym",
|
|
49
47
|
scope,
|
|
50
|
-
refkey: "foo",
|
|
51
48
|
});
|
|
52
49
|
|
|
53
50
|
expect(s2.name).toEqual("sym_2");
|
|
@@ -506,3 +503,62 @@ describe("symbol name resolution", () => {
|
|
|
506
503
|
expect(result.value).toEqual(instance);
|
|
507
504
|
});
|
|
508
505
|
});
|
|
506
|
+
|
|
507
|
+
describe("refkey resolution", () => {
|
|
508
|
+
it("resolves existing symbols by refkey", () => {
|
|
509
|
+
const key = refkey();
|
|
510
|
+
const binder = createOutputBinder();
|
|
511
|
+
const sym = binder.createSymbol({
|
|
512
|
+
name: "foo",
|
|
513
|
+
refkey: key,
|
|
514
|
+
scope: binder.globalScope,
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
const resolvedSym = binder.resolveDeclarationByKey(
|
|
518
|
+
undefined,
|
|
519
|
+
undefined,
|
|
520
|
+
key,
|
|
521
|
+
);
|
|
522
|
+
expect(resolvedSym.value?.targetDeclaration).toBe(sym);
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
it("resolves symbols by refkey when symbol is added later", () => {
|
|
526
|
+
const key = refkey();
|
|
527
|
+
const binder = createOutputBinder();
|
|
528
|
+
|
|
529
|
+
const resolvedSym = binder.resolveDeclarationByKey(
|
|
530
|
+
undefined,
|
|
531
|
+
undefined,
|
|
532
|
+
key,
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
const sym = binder.createSymbol({
|
|
536
|
+
name: "foo",
|
|
537
|
+
refkey: key,
|
|
538
|
+
scope: binder.globalScope,
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
expect(resolvedSym.value?.targetDeclaration).toBe(sym);
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it("resolves symbols by refkey when refkey is added later", () => {
|
|
545
|
+
const key = refkey();
|
|
546
|
+
const binder = createOutputBinder();
|
|
547
|
+
|
|
548
|
+
const resolvedSym = binder.resolveDeclarationByKey(
|
|
549
|
+
undefined,
|
|
550
|
+
undefined,
|
|
551
|
+
key,
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
const sym = binder.createSymbol({
|
|
555
|
+
name: "foo",
|
|
556
|
+
scope: binder.globalScope,
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
expect(resolvedSym.value).toBe(undefined);
|
|
560
|
+
|
|
561
|
+
sym.refkey = key;
|
|
562
|
+
expect(resolvedSym.value?.targetDeclaration).toBe(sym);
|
|
563
|
+
});
|
|
564
|
+
});
|