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.
- package/dist/.build-complete +1 -1
- package/dist/FrameworkConfig.d.ts +2 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/FrameworkConfig.types.test.d.ts +2 -0
- package/dist/FrameworkConfig.types.test.d.ts.map +1 -0
- package/dist/FrameworkConfig.types.test.js +6 -0
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +6 -33
- package/dist/Instance/InstanceConfig.d.ts +1 -0
- package/dist/Instance/InstanceConfig.d.ts.map +1 -1
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +10 -1
- package/dist/Servers/ProdServer.d.ts +1 -0
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +18 -1
- package/dist/Servers/routing.d.ts.map +1 -1
- package/dist/Servers/routing.js +9 -5
- package/dist/Servers/stubInstance.d.ts +8 -0
- package/dist/Servers/stubInstance.d.ts.map +1 -0
- package/dist/Servers/stubInstance.js +40 -0
- package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
- package/dist/build/createInstanceConfigFile.js +1 -1
- package/dist/build/rollupProdConstants.d.ts.map +1 -1
- package/dist/componentHelpers.d.ts +2 -1
- package/dist/componentHelpers.d.ts.map +1 -1
- package/dist/componentHelpers.js +3 -0
- package/dist/frameworkConfigSchema.d.ts +2 -0
- package/dist/frameworkConfigSchema.d.ts.map +1 -1
- package/dist/frameworkConfigSchema.js +4 -1
- package/dist/getUserConfig.d.ts.map +1 -1
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +31 -10
- package/dist/hydrate/stubRouting.d.ts +8 -0
- package/dist/hydrate/stubRouting.d.ts.map +1 -0
- package/dist/hydrate/stubRouting.js +25 -0
- package/dist/makeFinalConfig.d.ts.map +1 -1
- package/dist/makeFinalConfig.js +2 -0
- package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
- package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -0
- package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -1
- package/dist/pipeline/PipelineRequestHandler.js +9 -1
- package/dist/pipeline/hydratePipeline.d.ts.map +1 -1
- package/dist/pipeline/hydratePipeline.js +28 -9
- package/dist/pipeline/pipeline.d.ts +35 -33
- package/dist/pipeline/pipeline.d.ts.map +1 -1
- package/dist/pipeline/pipeline.js +10 -5
- package/dist/pipeline/pipeline.types.test.d.ts +186 -76
- package/dist/pipeline/pipeline.types.test.d.ts.map +1 -1
- package/dist/pipeline/pipeline.types.test.js +2 -0
- package/dist/pipeline/pipelineDefinition.d.ts +20 -9
- package/dist/pipeline/pipelineDefinition.d.ts.map +1 -1
- package/dist/pipeline/pipelineSplit.types.test.d.ts +598 -124
- package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -1
- package/dist/pipeline/runPipeline.d.ts +6 -8
- package/dist/pipeline/runPipeline.d.ts.map +1 -1
- package/dist/pipeline/runPipeline.js +8 -8
- package/dist/pipeline/runSplitPipeline.d.ts +3 -3
- package/dist/pipeline/runSplitPipeline.d.ts.map +1 -1
- package/dist/pipeline/runSplitPipeline.js +12 -8
- package/dist/pipeline/splitPipeline.d.ts +8 -8
- package/dist/pipeline/splitPipeline.d.ts.map +1 -1
- package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
- package/dist/render/contentTreeToRenderingTree.js +4 -1
- package/dist/routing/MatchedRouteInfo.d.ts +2 -0
- package/dist/routing/MatchedRouteInfo.d.ts.map +1 -1
- package/dist/routing/MatchedRouteInfo.js +1 -1
- package/dist/routing/RouteContentFunction.d.ts +1 -1
- package/dist/routing/RouteContentFunction.d.ts.map +1 -1
- package/dist/routing/RouteTypes.d.ts +1 -1
- package/dist/routing/RouteTypes.d.ts.map +1 -1
- package/dist/routing/Routes.d.ts +6 -3
- package/dist/routing/Routes.d.ts.map +1 -1
- package/dist/routing/builder.d.ts +2 -1
- package/dist/routing/builder.d.ts.map +1 -1
- package/dist/routing/builder.js +6 -0
- package/dist/routing/redirectOf.d.ts +11 -0
- package/dist/routing/redirectOf.d.ts.map +1 -0
- package/dist/routing/redirectOf.js +32 -0
- package/dist/routing/routesArray.d.ts +2 -2
- package/dist/routing/routesArray.d.ts.map +1 -1
- package/dist/routing/routingBuilder.js +0 -1
- package/dist/testing/contentToString.d.ts +13 -0
- package/dist/testing/contentToString.d.ts.map +1 -0
- package/dist/testing/contentToString.js +105 -0
- package/dist/testing/display.d.ts +2 -0
- package/dist/testing/display.d.ts.map +1 -0
- package/dist/testing/display.js +37 -0
- package/dist/testing/ensure.d.ts +52 -41
- package/dist/testing/ensure.d.ts.map +1 -1
- package/dist/testing/ensure.js +204 -62
- package/dist/testing/ensure.types.test.d.ts +2 -0
- package/dist/testing/ensure.types.test.d.ts.map +1 -0
- package/dist/testing/ensure.types.test.js +34 -0
- package/dist/testing/host.d.ts +25 -25
- package/dist/testing/host.d.ts.map +1 -1
- package/dist/testing/host.js +1 -3
- package/dist/testing/host.types.test.d.ts +2 -0
- package/dist/testing/host.types.test.d.ts.map +1 -0
- package/dist/testing/host.types.test.js +81 -0
- package/dist/testing/hydrateTestApp.js +4 -3
- package/dist/testing/index.d.ts +2 -3
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -2
- package/dist/testing/pipeline/createTestPacketApp.d.ts +30 -0
- package/dist/testing/pipeline/createTestPacketApp.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPacketApp.js +45 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts +3 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPacketApp.types.test.js +101 -0
- package/dist/testing/pipeline/createTestPipelineApp.d.ts +70 -0
- package/dist/testing/pipeline/createTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPipelineApp.js +90 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts +6 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/createTestPipelineApp.types.test.js +146 -0
- package/dist/testing/pipeline/hostPipeline.d.ts +25 -0
- package/dist/testing/pipeline/hostPipeline.d.ts.map +1 -0
- package/dist/testing/pipeline/hostPipeline.js +18 -0
- package/dist/testing/{hydrateTestPipelineApp.d.ts → pipeline/hydrateTestPipelineApp.d.ts} +6 -6
- package/dist/testing/pipeline/hydrateTestPipelineApp.d.ts.map +1 -0
- package/dist/testing/{hydrateTestPipelineApp.js → pipeline/hydrateTestPipelineApp.js} +22 -19
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts +2 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.d.ts.map +1 -0
- package/dist/testing/pipeline/hydrateTestPipelineApp.types.test.js +27 -0
- package/dist/testing/pipeline/index.d.ts +5 -0
- package/dist/testing/pipeline/index.d.ts.map +1 -0
- package/dist/testing/pipeline/index.js +4 -0
- package/dist/testing/pipeline/pipelineTestApp.d.ts +34 -0
- package/dist/testing/pipeline/pipelineTestApp.d.ts.map +1 -0
- package/dist/testing/pipeline/pipelineTestApp.js +100 -0
- package/dist/testing/pipeline/testPipelineRoute.d.ts +2 -0
- package/dist/testing/pipeline/testPipelineRoute.d.ts.map +1 -0
- package/dist/testing/pipeline/testPipelineRoute.js +1 -0
- package/dist/testing/resolveContent.d.ts +2 -0
- package/dist/testing/resolveContent.d.ts.map +1 -1
- package/dist/testing/resolveContent.js +9 -1
- package/package.json +5 -3
- package/vendor/css-select.js +3383 -0
- package/vendor/manifest.json +4 -3
- package/dist/testing/createTestPipelineApp.d.ts +0 -25
- package/dist/testing/createTestPipelineApp.d.ts.map +0 -1
- package/dist/testing/createTestPipelineApp.js +0 -153
- package/dist/testing/hostPipeline.d.ts +0 -157
- package/dist/testing/hostPipeline.d.ts.map +0 -1
- package/dist/testing/hostPipeline.js +0 -341
- 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 @@
|
|
|
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
|
+
}
|
package/dist/testing/ensure.d.ts
CHANGED
|
@@ -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
|
-
|
|
43
|
-
|
|
44
|
-
readonly
|
|
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
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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
|
|
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[]) =>
|
|
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":"
|
|
1
|
+
{"version":3,"file":"ensure.d.ts","sourceRoot":"","sources":["../../src/testing/ensure.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAcpD,KAAK,IAAI,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAC3D,WAAW,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,MAAM,EAAE,GAAG,UAAU,CAAA;AACrE,KAAK,WAAW,GAAG,QAAQ,MAAM,EAAE,GAAG,aAAa,MAAM,EAAE,GAAG,UAAU,CAAA;AACxE,KAAK,UAAU,GAAG,UAAU,MAAM,EAAE,CAAA;AAEpC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;AAEtC,KAAK,OAAO,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CA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