@alloy-js/core 0.21.0-dev.0 → 0.21.0-dev.10
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/src/binder.d.ts +3 -3
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +18 -4
- package/dist/src/binder.js.map +1 -1
- package/dist/src/components/Declaration.js +1 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/MemberDeclaration.js +1 -1
- package/dist/src/components/MemberDeclaration.js.map +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts.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/library-symbol-reference.d.ts +8 -0
- package/dist/src/library-symbol-reference.d.ts.map +1 -0
- package/dist/src/library-symbol-reference.js +5 -0
- package/dist/src/library-symbol-reference.js.map +1 -0
- package/dist/src/name-policy.d.ts +2 -2
- package/dist/src/name-policy.d.ts.map +1 -1
- package/dist/src/name-policy.js +14 -1
- package/dist/src/name-policy.js.map +1 -1
- package/dist/src/pretty-string/pretty-string.d.ts +47 -0
- package/dist/src/pretty-string/pretty-string.d.ts.map +1 -0
- package/dist/src/pretty-string/pretty-string.js +100 -0
- package/dist/src/pretty-string/pretty-string.js.map +1 -0
- package/dist/src/pretty-string/pretty-string.test.d.ts +2 -0
- package/dist/src/pretty-string/pretty-string.test.d.ts.map +1 -0
- package/dist/src/pretty-string/pretty-string.test.js +38 -0
- package/dist/src/pretty-string/pretty-string.test.js.map +1 -0
- package/dist/src/refkey.d.ts +12 -8
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +40 -12
- package/dist/src/refkey.js.map +1 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +10 -4
- package/dist/src/render.js.map +1 -1
- package/dist/src/runtime/component.d.ts +22 -2
- package/dist/src/runtime/component.d.ts.map +1 -1
- package/dist/src/runtime/component.js +18 -0
- package/dist/src/runtime/component.js.map +1 -1
- package/dist/src/symbols/output-scope.d.ts +1 -0
- package/dist/src/symbols/output-scope.d.ts.map +1 -1
- package/dist/src/symbols/output-scope.js +4 -0
- package/dist/src/symbols/output-scope.js.map +1 -1
- package/dist/src/symbols/output-symbol.d.ts +10 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +33 -0
- package/dist/src/symbols/output-symbol.js.map +1 -1
- package/dist/src/tracer.d.ts.map +1 -1
- package/dist/src/tracer.js +2 -2
- package/dist/src/tracer.js.map +1 -1
- package/dist/test/refkey.test.js +11 -1
- package/dist/test/refkey.test.js.map +1 -1
- package/dist/test/rendering/basic.test.js +22 -0
- package/dist/test/rendering/basic.test.js.map +1 -1
- package/dist/test/symbols/output-scope.test.js +4 -3
- package/dist/test/symbols/output-scope.test.js.map +1 -1
- package/dist/test/symbols/resolution.test.js +29 -1
- package/dist/test/symbols/resolution.test.js.map +1 -1
- package/dist/testing/create-test-wrapper.d.ts +22 -0
- package/dist/testing/create-test-wrapper.d.ts.map +1 -0
- package/dist/testing/create-test-wrapper.js +60 -0
- package/dist/testing/create-test-wrapper.js.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/binder.ts +34 -6
- package/src/components/Declaration.tsx +1 -1
- package/src/components/MemberDeclaration.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/library-symbol-reference.ts +20 -0
- package/src/name-policy.ts +22 -3
- package/src/pretty-string/pretty-string.test.ts +47 -0
- package/src/pretty-string/pretty-string.ts +130 -0
- package/src/refkey.ts +67 -26
- package/src/render.ts +11 -3
- package/src/runtime/component.ts +33 -1
- package/src/symbols/output-scope.ts +7 -0
- package/src/symbols/output-symbol.ts +44 -0
- package/src/tracer.ts +2 -5
- package/temp/api.json +792 -88
- package/test/refkey.test.ts +12 -1
- package/test/rendering/basic.test.tsx +35 -1
- package/test/symbols/output-scope.test.ts +4 -4
- package/test/symbols/resolution.test.ts +42 -1
- package/testing/create-test-wrapper.tsx +70 -0
- package/testing/index.ts +1 -0
- package/tsconfig.json +1 -0
|
@@ -94,6 +94,11 @@ export interface OutputSymbolOptions {
|
|
|
94
94
|
* also ignoring name conflict resolution.
|
|
95
95
|
*/
|
|
96
96
|
ignoreNameConflict?: boolean;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Provide a function which lazy-initializes members when an enumeration of members are needed.
|
|
100
|
+
*/
|
|
101
|
+
lazyMemberInitializer?: () => void;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
let symbolCount = 0;
|
|
@@ -459,6 +464,40 @@ export abstract class OutputSymbol {
|
|
|
459
464
|
return this.#namePolicy;
|
|
460
465
|
}
|
|
461
466
|
|
|
467
|
+
#lazyMemberInitializer: (() => void) | undefined;
|
|
468
|
+
#lazyMembersInitialized: boolean = false;
|
|
469
|
+
|
|
470
|
+
#initializeMembers() {
|
|
471
|
+
if (this.#lazyMemberInitializer && !this.#lazyMembersInitialized) {
|
|
472
|
+
this.#lazyMemberInitializer();
|
|
473
|
+
}
|
|
474
|
+
this.#lazyMembersInitialized = true;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Get a member symbol by name from this symbol's member spaces. Checks member
|
|
479
|
+
* spaces in order until it finds a member with that name.
|
|
480
|
+
*/
|
|
481
|
+
resolveMemberByName(name: string): OutputSymbol | undefined {
|
|
482
|
+
this.#initializeMembers();
|
|
483
|
+
|
|
484
|
+
if (this.isTyped) {
|
|
485
|
+
if (!this.hasTypeSymbol) {
|
|
486
|
+
return undefined;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return this.type!.resolveMemberByName(name);
|
|
490
|
+
}
|
|
491
|
+
for (const space of this.memberSpaces) {
|
|
492
|
+
const member = space.symbolNames.get(name);
|
|
493
|
+
if (member) {
|
|
494
|
+
return member;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return undefined;
|
|
499
|
+
}
|
|
500
|
+
|
|
462
501
|
// Tell \@vue/reactivity that this symbol should never be wrapped in a reactive
|
|
463
502
|
// proxy.
|
|
464
503
|
[ReactiveFlags.SKIP] = true;
|
|
@@ -502,6 +541,7 @@ export abstract class OutputSymbol {
|
|
|
502
541
|
this.#isTransient = !!options.transient;
|
|
503
542
|
this.#isTyped = !!options.type;
|
|
504
543
|
this.type = options.type;
|
|
544
|
+
this.#lazyMemberInitializer = options.lazyMemberInitializer;
|
|
505
545
|
|
|
506
546
|
this.#handleNewSpaces(this.#spaces);
|
|
507
547
|
const constructor = this.constructor as typeof OutputSymbol;
|
|
@@ -630,6 +670,10 @@ export abstract class OutputSymbol {
|
|
|
630
670
|
}
|
|
631
671
|
|
|
632
672
|
[inspect.custom]() {
|
|
673
|
+
return this.toString();
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
toString() {
|
|
633
677
|
return untrack(() => `${this.constructor.name} "${this.name}"[${this.id}]`);
|
|
634
678
|
}
|
|
635
679
|
}
|
package/src/tracer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { effect, ReactiveEffectRunner } from "@vue/reactivity";
|
|
2
2
|
import { untrack } from "./reactivity.js";
|
|
3
|
-
import {
|
|
3
|
+
import { inspectRefkey, type Refkey } from "./refkey.js";
|
|
4
4
|
import { scheduler } from "./scheduler.js";
|
|
5
5
|
import { type OutputScope } from "./symbols/output-scope.js";
|
|
6
6
|
import type {
|
|
@@ -429,10 +429,7 @@ export function formatRefkeys(refkeys: Refkey[] | Refkey | undefined) {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
function formatRefkey(refkey: Refkey): string {
|
|
432
|
-
const text =
|
|
433
|
-
isMemberRefkey(refkey) ?
|
|
434
|
-
`memberRefkey[${formatRefkey(refkey.base)} -> ${formatRefkey(refkey.member)}]`
|
|
435
|
-
: `refkey[${refkey.key}]`;
|
|
432
|
+
const text = inspectRefkey(refkey);
|
|
436
433
|
|
|
437
434
|
return colorText(text, {
|
|
438
435
|
fg: {
|