tungsten 0.7.0 → 0.7.1

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.
Files changed (146) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/FrameworkConfig.d.ts +2 -0
  3. package/dist/FrameworkConfig.d.ts.map +1 -1
  4. package/dist/FrameworkConfig.types.test.d.ts +2 -0
  5. package/dist/FrameworkConfig.types.test.d.ts.map +1 -0
  6. package/dist/FrameworkConfig.types.test.js +6 -0
  7. package/dist/Instance/Instance.d.ts.map +1 -1
  8. package/dist/Instance/Instance.js +6 -33
  9. package/dist/Instance/InstanceConfig.d.ts +1 -0
  10. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  11. package/dist/Servers/DevServer.d.ts.map +1 -1
  12. package/dist/Servers/DevServer.js +10 -1
  13. package/dist/Servers/ProdServer.d.ts +1 -0
  14. package/dist/Servers/ProdServer.d.ts.map +1 -1
  15. package/dist/Servers/ProdServer.js +18 -1
  16. package/dist/Servers/routing.d.ts.map +1 -1
  17. package/dist/Servers/routing.js +9 -5
  18. package/dist/Servers/stubInstance.d.ts +8 -0
  19. package/dist/Servers/stubInstance.d.ts.map +1 -0
  20. package/dist/Servers/stubInstance.js +40 -0
  21. package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
  22. package/dist/build/createInstanceConfigFile.js +1 -1
  23. package/dist/build/rollupProdConstants.d.ts.map +1 -1
  24. package/dist/componentHelpers.d.ts +2 -1
  25. package/dist/componentHelpers.d.ts.map +1 -1
  26. package/dist/componentHelpers.js +3 -0
  27. package/dist/frameworkConfigSchema.d.ts +2 -0
  28. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  29. package/dist/frameworkConfigSchema.js +4 -1
  30. package/dist/getUserConfig.d.ts.map +1 -1
  31. package/dist/hydrate/hydrate.d.ts.map +1 -1
  32. package/dist/hydrate/hydrate.js +31 -10
  33. package/dist/hydrate/stubRouting.d.ts +8 -0
  34. package/dist/hydrate/stubRouting.d.ts.map +1 -0
  35. package/dist/hydrate/stubRouting.js +25 -0
  36. package/dist/makeFinalConfig.d.ts.map +1 -1
  37. package/dist/makeFinalConfig.js +2 -0
  38. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  39. package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -0
  40. package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -1
  41. package/dist/pipeline/PipelineRequestHandler.js +9 -1
  42. package/dist/pipeline/hydratePipeline.d.ts.map +1 -1
  43. package/dist/pipeline/hydratePipeline.js +28 -9
  44. package/dist/pipeline/pipeline.d.ts +35 -33
  45. package/dist/pipeline/pipeline.d.ts.map +1 -1
  46. package/dist/pipeline/pipeline.js +10 -5
  47. package/dist/pipeline/pipeline.types.test.d.ts +186 -76
  48. package/dist/pipeline/pipeline.types.test.d.ts.map +1 -1
  49. package/dist/pipeline/pipeline.types.test.js +2 -0
  50. package/dist/pipeline/pipelineDefinition.d.ts +20 -9
  51. package/dist/pipeline/pipelineDefinition.d.ts.map +1 -1
  52. package/dist/pipeline/pipelineSplit.types.test.d.ts +598 -124
  53. package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -1
  54. package/dist/pipeline/runPipeline.d.ts +6 -8
  55. package/dist/pipeline/runPipeline.d.ts.map +1 -1
  56. package/dist/pipeline/runPipeline.js +8 -8
  57. package/dist/pipeline/runSplitPipeline.d.ts +3 -3
  58. package/dist/pipeline/runSplitPipeline.d.ts.map +1 -1
  59. package/dist/pipeline/runSplitPipeline.js +12 -8
  60. package/dist/pipeline/splitPipeline.d.ts +8 -8
  61. package/dist/pipeline/splitPipeline.d.ts.map +1 -1
  62. package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
  63. package/dist/render/contentTreeToRenderingTree.js +4 -1
  64. package/dist/routing/MatchedRouteInfo.d.ts +2 -0
  65. package/dist/routing/MatchedRouteInfo.d.ts.map +1 -1
  66. package/dist/routing/MatchedRouteInfo.js +1 -1
  67. package/dist/routing/RouteContentFunction.d.ts +1 -1
  68. package/dist/routing/RouteContentFunction.d.ts.map +1 -1
  69. package/dist/routing/RouteTypes.d.ts +1 -1
  70. package/dist/routing/RouteTypes.d.ts.map +1 -1
  71. package/dist/routing/Routes.d.ts +6 -3
  72. package/dist/routing/Routes.d.ts.map +1 -1
  73. package/dist/routing/builder.d.ts +2 -1
  74. package/dist/routing/builder.d.ts.map +1 -1
  75. package/dist/routing/builder.js +6 -0
  76. package/dist/routing/redirectOf.d.ts +11 -0
  77. package/dist/routing/redirectOf.d.ts.map +1 -0
  78. package/dist/routing/redirectOf.js +32 -0
  79. package/dist/routing/routesArray.d.ts +2 -2
  80. package/dist/routing/routesArray.d.ts.map +1 -1
  81. package/dist/routing/routingBuilder.js +0 -1
  82. package/dist/testing/contentToString.d.ts +13 -0
  83. package/dist/testing/contentToString.d.ts.map +1 -0
  84. package/dist/testing/contentToString.js +105 -0
  85. package/dist/testing/display.d.ts +2 -0
  86. package/dist/testing/display.d.ts.map +1 -0
  87. package/dist/testing/display.js +37 -0
  88. package/dist/testing/ensure.d.ts +52 -41
  89. package/dist/testing/ensure.d.ts.map +1 -1
  90. package/dist/testing/ensure.js +204 -62
  91. package/dist/testing/ensure.types.test.d.ts +2 -0
  92. package/dist/testing/ensure.types.test.d.ts.map +1 -0
  93. package/dist/testing/ensure.types.test.js +34 -0
  94. package/dist/testing/host.d.ts +25 -25
  95. package/dist/testing/host.d.ts.map +1 -1
  96. package/dist/testing/host.js +1 -3
  97. package/dist/testing/host.types.test.d.ts +2 -0
  98. package/dist/testing/host.types.test.d.ts.map +1 -0
  99. package/dist/testing/host.types.test.js +81 -0
  100. package/dist/testing/hydrateTestApp.js +4 -3
  101. package/dist/testing/index.d.ts +2 -3
  102. package/dist/testing/index.d.ts.map +1 -1
  103. package/dist/testing/index.js +1 -2
  104. package/dist/testing/pipeline/createTestPacketApp.d.ts +30 -0
  105. package/dist/testing/pipeline/createTestPacketApp.d.ts.map +1 -0
  106. package/dist/testing/pipeline/createTestPacketApp.js +45 -0
  107. package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts +3 -0
  108. package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts.map +1 -0
  109. package/dist/testing/pipeline/createTestPacketApp.types.test.js +101 -0
  110. package/dist/testing/pipeline/createTestPipelineApp.d.ts +70 -0
  111. package/dist/testing/pipeline/createTestPipelineApp.d.ts.map +1 -0
  112. package/dist/testing/pipeline/createTestPipelineApp.js +90 -0
  113. package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts +6 -0
  114. package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts.map +1 -0
  115. package/dist/testing/pipeline/createTestPipelineApp.types.test.js +146 -0
  116. package/dist/testing/pipeline/hostPipeline.d.ts +25 -0
  117. package/dist/testing/pipeline/hostPipeline.d.ts.map +1 -0
  118. package/dist/testing/pipeline/hostPipeline.js +18 -0
  119. package/dist/testing/{hydrateTestPipelineApp.d.ts → pipeline/hydrateTestPipelineApp.d.ts} +6 -6
  120. package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts.map +1 -0
  121. package/dist/testing/{hydrateTestPipelineApp.js → pipeline/hydrateTestPipelineApp.js} +22 -19
  122. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts +2 -0
  123. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts.map +1 -0
  124. package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.js +27 -0
  125. package/dist/testing/pipeline/index.d.ts +5 -0
  126. package/dist/testing/pipeline/index.d.ts.map +1 -0
  127. package/dist/testing/pipeline/index.js +4 -0
  128. package/dist/testing/pipeline/pipelineTestApp.d.ts +34 -0
  129. package/dist/testing/pipeline/pipelineTestApp.d.ts.map +1 -0
  130. package/dist/testing/pipeline/pipelineTestApp.js +100 -0
  131. package/dist/testing/pipeline/testPipelineRoute.d.ts +2 -0
  132. package/dist/testing/pipeline/testPipelineRoute.d.ts.map +1 -0
  133. package/dist/testing/pipeline/testPipelineRoute.js +1 -0
  134. package/dist/testing/resolveContent.d.ts +2 -0
  135. package/dist/testing/resolveContent.d.ts.map +1 -1
  136. package/dist/testing/resolveContent.js +9 -1
  137. package/package.json +5 -3
  138. package/vendor/css-select.js +3383 -0
  139. package/vendor/manifest.json +4 -3
  140. package/dist/testing/createTestPipelineApp.d.ts +0 -25
  141. package/dist/testing/createTestPipelineApp.d.ts.map +0 -1
  142. package/dist/testing/createTestPipelineApp.js +0 -153
  143. package/dist/testing/hostPipeline.d.ts +0 -157
  144. package/dist/testing/hostPipeline.d.ts.map +0 -1
  145. package/dist/testing/hostPipeline.js +0 -341
  146. package/dist/testing/hydrateTestPipelineApp.d.ts.map +0 -1
@@ -0,0 +1,105 @@
1
+ import { ContentNodeIsArray, ContentNodeIsElement, ContentNodeIsFragment, ContentNodeIsLiteral, IsContentNode } from '../ContentNode.js';
2
+ import { $fragment, $key, $props, $type } from '../contentNodeSymbols.js';
3
+ import { componentTypeIdentityKey } from '../hmr/componentIdentity.js';
4
+ import { display } from './display.js';
5
+ import { $passedChildren } from './resolveContent.js';
6
+ const indent = ' ';
7
+ const width = 100;
8
+ /**
9
+ * The tree as JSX. A component host() resolved has its output under it, marked ⤵, and the children
10
+ * it was passed as a prop; one unresolved holds its passed children, as written.
11
+ */
12
+ export function contentToString(content, options = {}) {
13
+ const lines = contentLines(content, '', options);
14
+ if (lines.length > 0) return lines.join('\n');
15
+ // a tree that renders nothing says what it was: null and false are different returns
16
+ return ContentNodeIsFragment(content) ? '<></>' : `{${display(content)}}`;
17
+ }
18
+ // adjacent text is one line, as the page shows it: JSX splits `Hi, {name}.` into three
19
+ function contentLines(content, at, options) {
20
+ const lines = [];
21
+ let text;
22
+ for (const node of rendered(content, options)) {
23
+ if (ContentNodeIsLiteral(node)) text = (text ?? '') + String(node);else {
24
+ if (text !== undefined) lines.push(at + textLine(text));
25
+ text = undefined;
26
+ lines.push(...elementLines(node, at, options));
27
+ }
28
+ }
29
+ if (text !== undefined) lines.push(at + textLine(text));
30
+ return lines;
31
+ }
32
+ // quoted where spaces at an edge, or no text at all, would not show
33
+ const textLine = text => text !== '' && text === text.trim() ? text : `{${display(text)}}`;
34
+ // arrays flattened, and fragments unless asked for, as neither renders anything of its own;
35
+ // null, undefined and booleans render nothing
36
+ function rendered(content, options) {
37
+ if (ContentNodeIsArray(content)) return content.flatMap(each => rendered(each, options));
38
+ if (ContentNodeIsFragment(content) && options.fragments !== true) {
39
+ return rendered(content[$props].children, options);
40
+ }
41
+ return ContentNodeIsLiteral(content) || ContentNodeIsElement(content) ? [content] : [];
42
+ }
43
+ function elementLines(node, at, options) {
44
+ const type = node[$type];
45
+ if (type === $fragment) {
46
+ const body = contentLines(node[$props].children, at + indent, options);
47
+ return body.length === 0 ? [`${at}<></>`] : [`${at}<>`, ...body, `${at}</>`];
48
+ }
49
+ const name = typeof type === 'string' ? type : componentTypeIdentityKey(type);
50
+ const {
51
+ children,
52
+ ...props
53
+ } = node[$props];
54
+ const key = node[$key];
55
+ const attributes = [...(key === undefined || key === null ? [] : [attribute('key', key)]), ...Object.entries(props).map(([prop, value]) => attribute(prop, value))];
56
+ const resolved = $passedChildren in node;
57
+ const passed = resolved && IsContentNode(node[$passedChildren]) ? node[$passedChildren] : null;
58
+ const passedNodes = rendered(passed, options);
59
+ const passedLines = passedNodes.every(each => ContentNodeIsLiteral(each)) ? [] // none, or text, which is a prop like any other
60
+ : options.children === true ? elementsLines(passed, at + indent, options) : [];
61
+ if (passedNodes.length > 0 && passedLines.length === 0) {
62
+ attributes.push(options.children === true ? attribute('children', passedNodes.join('')) : 'children={...}');
63
+ }
64
+ const body = contentLines(children, at + indent, options);
65
+ const opened = end => passedLines.length === 0 ? tag(`<${name}`, attributes, end, at) : [...tag(`<${name}`, attributes, ' children={', at), ...passedLines, `${at}}${end}`];
66
+ if (body.length === 0) return opened(' />');
67
+ const close = `</${name}>`;
68
+ if (resolved) return [...opened('> ⤵'), ...body, at + close];
69
+ const text = rendered(children, options).every(each => ContentNodeIsLiteral(each));
70
+ const open = opened('>');
71
+ const inline = `${open.at(-1) ?? ''}${body[0]?.trim() ?? ''}${close}`;
72
+ if (text && body.length === 1 && inline.length <= width) return [...open.slice(0, -1), inline];
73
+ return [...open, ...body, at + close];
74
+ }
75
+ // passed children as one JSX expression: an element, or a fragment round several
76
+ function elementsLines(content, at, options) {
77
+ const [only, ...more] = rendered(content, options);
78
+ if (only !== undefined && more.length === 0 && !ContentNodeIsLiteral(only)) {
79
+ return elementLines(only, at, options);
80
+ }
81
+ return [`${at}<>`, ...contentLines(content, at + indent, options), `${at}</>`];
82
+ }
83
+ // an opening tag, its attributes wrapped to the width, each line after the first indented
84
+ function tag(start, attributes, end, at) {
85
+ const lines = [];
86
+ let line = at + start;
87
+ let empty = true; // nothing yet on this line to break after
88
+ attributes.forEach((each, i) => {
89
+ const after = i === attributes.length - 1 ? end : '';
90
+ if (!empty && `${line} ${each}${after}`.length > width) {
91
+ lines.push(line);
92
+ line = at + indent + each;
93
+ } else line += ` ${each}`;
94
+ empty = false;
95
+ });
96
+ return [...lines, line + end];
97
+ }
98
+ function attribute(name, value) {
99
+ if (typeof value === 'string') return `${name}=${display(value)}`;
100
+ // ƒ and the name, not source: an inline arrow takes its prop's name, a bound one 'bound x'
101
+ if (typeof value === 'function') {
102
+ return `${name}={ƒ${value.name === '' ? '' : ` ${value.name}`}}`;
103
+ }
104
+ return `${name}={${display(value)}}`;
105
+ }
@@ -0,0 +1,2 @@
1
+ export declare function display(value: unknown, depth?: number): string;
2
+ //# sourceMappingURL=display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/testing/display.ts"],"names":[],"mappings":"AAUA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,MAAM,CAmCzD"}
@@ -0,0 +1,37 @@
1
+ import { ContentNodeIsElement, IsContentNode } from '../ContentNode.js';
2
+ import { $fragment, $type } from '../contentNodeSymbols.js';
3
+ import { componentTypeIdentityKey } from '../hmr/componentIdentity.js';
4
+ const displayed = 5; // entries shown of an array or object
5
+ const displayDepth = 2;
6
+ // a value as a failure message shows it; arrays and objects shortened by length and depth
7
+ export function display(value, depth = 0) {
8
+ if (typeof value === 'string') return `'${value}'`;
9
+ if (typeof value === 'function') {
10
+ return value.name === '' ? '[function]' : `[function ${value.name}]`;
11
+ }
12
+ if (typeof value !== 'object' || value === null) {
13
+ return String(value); // a number, boolean, bigint, symbol, null or undefined
14
+ }
15
+ if (value instanceof Date) {
16
+ return isNaN(value.getTime()) ? 'Date(invalid)' : `Date(${value.toISOString()})`;
17
+ }
18
+ // an element held as a value, as in a prop: by tag or name, as its symbol keys hide it as data
19
+ if ($type in value && IsContentNode(value) && ContentNodeIsElement(value)) {
20
+ const type = value[$type];
21
+ if (type === $fragment) return '<>';
22
+ return `<${typeof type === 'string' ? type : componentTypeIdentityKey(type)}>`;
23
+ }
24
+ const shown = entries => depth >= displayDepth ? '…' : entries.slice(0, displayed).join(', ') + (entries.length > displayed ? ', …' : '');
25
+ if (Array.isArray(value)) {
26
+ return value.length === 0 ? '[]' : `[${shown(value.map(each => display(each, depth + 1)))}]`;
27
+ }
28
+ if (value instanceof Set) {
29
+ return `Set { ${shown([...value].map(each => display(each, depth + 1)))} }`;
30
+ }
31
+ if (value instanceof Map) {
32
+ const pairs = [...value].map(([key, each]) => `${display(key, depth + 1)} => ${display(each, depth + 1)}`);
33
+ return `Map { ${shown(pairs)} }`;
34
+ }
35
+ const entries = Object.entries(value).map(([key, each]) => `${key}: ${display(each, depth + 1)}`);
36
+ return entries.length === 0 ? '{}' : `{ ${shown(entries)} }`;
37
+ }
@@ -1,6 +1,7 @@
1
1
  import type { ContentNode } from '../ContentNode.js';
2
- type Kind = 'text' | 'interruptedText' | ElementKind | 'fragment' | 'className' | 'id' | 'children' | `prop:${string}`;
3
- type ElementKind = `html:${string}` | `component:${string}`;
2
+ type Kind = 'text' | 'interruptedText' | ElementKind | 'fragment' | 'className' | 'id' | 'children' | `prop:${string}` | 'elements';
3
+ type ElementKind = `html:${string}` | `component:${string}` | SelectKind;
4
+ type SelectKind = `select:${string}`;
4
5
  type Test = (seen: unknown) => boolean;
5
6
  type Failure = {
6
7
  actual: unknown;
@@ -39,51 +40,60 @@ type Props = Record<string, unknown> & {
39
40
  children?: ContentNode;
40
41
  };
41
42
  type WithFn = (props: Props) => boolean;
42
- type Quantifiers = {
43
- readonly no: Ends;
44
- readonly none: Ends;
45
- readonly one: Ends;
46
- readonly two: Ends;
47
- readonly three: Ends;
48
- readonly count: (num: number) => Ends;
49
- readonly a: Ends;
50
- readonly an: Ends;
51
- readonly some: Ends;
52
- readonly all: Ends;
43
+ declare const property: unique symbol;
44
+ type PropertyFact = Fact & {
45
+ readonly [property]: true;
53
46
  };
54
- type StringEnd = ((text: string) => Fact) & {
55
- contains: (substring: string) => Fact;
56
- matches: (regex: RegExp) => Fact;
47
+ type Made<Scope extends Fact | undefined, Own extends Fact> = [Scope] extends [Fact] ? Scope : Own;
48
+ type Quantifiers<E> = {
49
+ readonly no: E;
50
+ readonly none: E;
51
+ readonly one: E;
52
+ readonly two: E;
53
+ readonly three: E;
54
+ readonly count: (num: number) => E;
55
+ readonly a: E;
56
+ readonly an: E;
57
+ readonly some: E;
58
+ readonly all: E;
57
59
  };
58
- type ElementEnd = Fact & {
59
- with: ((facts: Fact[] | WithFn) => Fact) & Quantifiers & {
60
- children: ((facts: Fact[]) => Fact) & Quantifiers;
60
+ type StringEnd<F extends Fact> = ((text: string) => F) & {
61
+ contains: (substring: string) => F;
62
+ matches: (regex: RegExp) => F;
63
+ };
64
+ type ElementEnd<F extends Fact> = F & {
65
+ with: ((facts: PropertyFact[] | WithFn) => F) & Quantifiers<PropertyEnds<F>> & {
66
+ children: ((facts: Fact[]) => F) & Quantifiers<Ends<F>>;
61
67
  };
62
68
  };
63
- type Ends = {
64
- text: StringEnd;
65
- textCi: StringEnd;
66
- interruptedText: StringEnd;
67
- html: (tag: string) => ElementEnd;
68
- component: (name: string) => ElementEnd;
69
- fragment: () => Fact;
70
- className: (className?: string) => Fact;
71
- id: (id?: string) => Fact;
72
- prop: (prop: string) => Fact & {
73
- is: (value: unknown) => Fact;
74
- contains: (substring: string) => Fact;
75
- matches: (regex: RegExp) => Fact;
76
- exact: (value: unknown) => Fact;
77
- subset: (shape: unknown) => Fact;
78
- duck: (shape: unknown) => Fact;
79
- content: () => Fact & {
80
- with: ((facts: Fact[]) => Fact) & Quantifiers;
81
- };
69
+ type PropEnd<F extends Fact> = F & {
70
+ is: (value: unknown) => F;
71
+ contains: (substring: string) => F;
72
+ matches: (regex: RegExp) => F;
73
+ exact: (value: unknown) => F;
74
+ subset: (shape: unknown) => F;
75
+ duck: (shape: unknown) => F;
76
+ content: () => F & {
77
+ with: ((facts: Fact[]) => F) & Quantifiers<Ends<F>>;
82
78
  };
83
79
  };
84
- declare const _ensure: typeof ensure & Quantifiers;
80
+ type Ends<Scope extends Fact | undefined = undefined> = {
81
+ text: StringEnd<Made<Scope, Fact>>;
82
+ textCi: StringEnd<Made<Scope, Fact>>;
83
+ interruptedText: StringEnd<Made<Scope, PropertyFact>>;
84
+ html: (tag: string) => ElementEnd<Made<Scope, Fact>>;
85
+ component: (name: string) => ElementEnd<Made<Scope, Fact>>;
86
+ select: (selector: string) => ElementEnd<Made<Scope, Fact>>;
87
+ fragment: () => Made<Scope, Fact>;
88
+ className: (className?: string) => Made<Scope, PropertyFact>;
89
+ id: (id?: string) => Made<Scope, PropertyFact>;
90
+ prop: (prop: string) => PropEnd<Made<Scope, PropertyFact>>;
91
+ };
92
+ declare const propertyEnds: readonly ["interruptedText", "className", "id", "prop"];
93
+ type PropertyEnds<F extends Fact> = Pick<Ends<F>, typeof propertyEnds[number]>;
94
+ declare const _ensure: typeof ensure & Quantifiers<Ends<undefined>>;
85
95
  export { _ensure as ensure };
86
- export declare const no: Ends, none: Ends, one: Ends, two: Ends, three: Ends, a: Ends, an: Ends, some: Ends, all: Ends, count: (num: number) => Ends;
96
+ export declare const no: Ends<undefined>, none: Ends<undefined>, one: Ends<undefined>, two: Ends<undefined>, three: Ends<undefined>, a: Ends<undefined>, an: Ends<undefined>, some: Ends<undefined>, all: Ends<undefined>, count: (num: number) => Ends<undefined>;
87
97
  export declare class EnsureError extends Error {
88
98
  actual: unknown;
89
99
  expected: unknown;
@@ -93,7 +103,7 @@ export declare class EnsureError extends Error {
93
103
  constructor(message: string, actual: unknown, expected: unknown, operator: string, showDiff: boolean);
94
104
  }
95
105
  declare function ensure(tree: ContentNode, facts: Fact[], options?: EnsureOptions): void;
96
- export declare const children: ((facts: Fact[]) => Fact) & Quantifiers;
106
+ export declare const children: ((facts: Fact[]) => PropertyFact) & Quantifiers<Ends<PropertyFact>>;
97
107
  type BuiltFact = {
98
108
  kind: Kind;
99
109
  test: Test;
@@ -105,4 +115,5 @@ type BuiltFact = {
105
115
  operator: string;
106
116
  };
107
117
  type Sighting = ['text', string] | [Exclude<Kind, 'text'>, unknown];
118
+ export declare const cssSelectBundle: string;
108
119
  //# sourceMappingURL=ensure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ensure.d.ts","sourceRoot":"","sources":["../../src/testing/ensure.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAWpD,KAAK,IAAI,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAC3D,WAAW,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,MAAM,EAAE,CAAA;AACxD,KAAK,WAAW,GAAG,QAAQ,MAAM,EAAE,GAAG,aAAa,MAAM,EAAE,CAAA;AAE3D,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;AAEtC,KAAK,OAAO,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,O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