@casual-simulation/expect 2.0.18
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/LICENSE +21 -0
- package/README.md +4 -0
- package/index.d.ts +6 -0
- package/index.js +5 -0
- package/index.js.map +1 -0
- package/package.json +35 -0
- package/src/asymmetricMatchers.d.ts +67 -0
- package/src/asymmetricMatchers.js +188 -0
- package/src/asymmetricMatchers.js.map +1 -0
- package/src/diff/cleanupSemantic.d.ts +58 -0
- package/src/diff/cleanupSemantic.js +526 -0
- package/src/diff/cleanupSemantic.js.map +1 -0
- package/src/diff/constants.d.ts +9 -0
- package/src/diff/constants.js +10 -0
- package/src/diff/constants.js.map +1 -0
- package/src/diff/diffLines.d.ts +13 -0
- package/src/diff/diffLines.js +138 -0
- package/src/diff/diffLines.js.map +1 -0
- package/src/diff/diffStrings.d.ts +10 -0
- package/src/diff/diffStrings.js +36 -0
- package/src/diff/diffStrings.js.map +1 -0
- package/src/diff/getAlignedDiffs.d.ts +11 -0
- package/src/diff/getAlignedDiffs.js +187 -0
- package/src/diff/getAlignedDiffs.js.map +1 -0
- package/src/diff/index.d.ts +16 -0
- package/src/diff/index.js +139 -0
- package/src/diff/index.js.map +1 -0
- package/src/diff/joinAlignedDiffs.d.ts +11 -0
- package/src/diff/joinAlignedDiffs.js +191 -0
- package/src/diff/joinAlignedDiffs.js.map +1 -0
- package/src/diff/normalizeDiffOptions.d.ts +10 -0
- package/src/diff/normalizeDiffOptions.js +40 -0
- package/src/diff/normalizeDiffOptions.js.map +1 -0
- package/src/diff/printDiffs.d.ts +11 -0
- package/src/diff/printDiffs.js +46 -0
- package/src/diff/printDiffs.js.map +1 -0
- package/src/diff/types.d.ts +49 -0
- package/src/diff/types.js +2 -0
- package/src/diff/types.js.map +1 -0
- package/src/diff-sequences/index.d.ts +19 -0
- package/src/diff-sequences/index.js +506 -0
- package/src/diff-sequences/index.js.map +1 -0
- package/src/extractExpectedAssertionsErrors.d.ts +11 -0
- package/src/extractExpectedAssertionsErrors.js +58 -0
- package/src/extractExpectedAssertionsErrors.js.map +1 -0
- package/src/get-type/index.d.ts +11 -0
- package/src/get-type/index.js +57 -0
- package/src/get-type/index.js.map +1 -0
- package/src/index.d.ts +16 -0
- package/src/index.js +247 -0
- package/src/index.js.map +1 -0
- package/src/jasmineUtils.d.ts +9 -0
- package/src/jasmineUtils.js +218 -0
- package/src/jasmineUtils.js.map +1 -0
- package/src/jestMatchersObject.d.ts +14 -0
- package/src/jestMatchersObject.js +78 -0
- package/src/jestMatchersObject.js.map +1 -0
- package/src/matcher-utils/Replaceable.d.ts +18 -0
- package/src/matcher-utils/Replaceable.js +57 -0
- package/src/matcher-utils/Replaceable.js.map +1 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.d.ts +8 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js +96 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js.map +1 -0
- package/src/matcher-utils/index.d.ts +53 -0
- package/src/matcher-utils/index.js +341 -0
- package/src/matcher-utils/index.js.map +1 -0
- package/src/matchers.d.ts +11 -0
- package/src/matchers.js +575 -0
- package/src/matchers.js.map +1 -0
- package/src/message-util/index.d.ts +11 -0
- package/src/message-util/index.js +34 -0
- package/src/message-util/index.js.map +1 -0
- package/src/pretty-format/collections.d.ts +33 -0
- package/src/pretty-format/collections.js +130 -0
- package/src/pretty-format/collections.js.map +1 -0
- package/src/pretty-format/index.d.ts +25 -0
- package/src/pretty-format/index.js +390 -0
- package/src/pretty-format/index.js.map +1 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.d.ts +12 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js +53 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js.map +1 -0
- package/src/pretty-format/plugins/ConvertAnsi.d.ts +12 -0
- package/src/pretty-format/plugins/ConvertAnsi.js +58 -0
- package/src/pretty-format/plugins/ConvertAnsi.js.map +1 -0
- package/src/pretty-format/plugins/DOMCollection.d.ts +12 -0
- package/src/pretty-format/plugins/DOMCollection.js +39 -0
- package/src/pretty-format/plugins/DOMCollection.js.map +1 -0
- package/src/pretty-format/plugins/DOMElement.d.ts +12 -0
- package/src/pretty-format/plugins/DOMElement.js +68 -0
- package/src/pretty-format/plugins/DOMElement.js.map +1 -0
- package/src/pretty-format/plugins/Immutable.d.ts +12 -0
- package/src/pretty-format/plugins/Immutable.js +113 -0
- package/src/pretty-format/plugins/Immutable.js.map +1 -0
- package/src/pretty-format/plugins/ReactTestComponent.d.ts +19 -0
- package/src/pretty-format/plugins/ReactTestComponent.js +29 -0
- package/src/pretty-format/plugins/ReactTestComponent.js.map +1 -0
- package/src/pretty-format/plugins/lib/escapeHTML.d.ts +8 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js +10 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js.map +1 -0
- package/src/pretty-format/plugins/lib/markup.d.ts +14 -0
- package/src/pretty-format/plugins/lib/markup.js +98 -0
- package/src/pretty-format/plugins/lib/markup.js.map +1 -0
- package/src/pretty-format/types.d.ts +109 -0
- package/src/pretty-format/types.js +8 -0
- package/src/pretty-format/types.js.map +1 -0
- package/src/print.d.ts +16 -0
- package/src/print.js +71 -0
- package/src/print.js.map +1 -0
- package/src/spyMatchers.d.ts +10 -0
- package/src/spyMatchers.js +766 -0
- package/src/spyMatchers.js.map +1 -0
- package/src/test-utils/ConditionalTest.d.ts +10 -0
- package/src/test-utils/ConditionalTest.js +25 -0
- package/src/test-utils/ConditionalTest.js.map +1 -0
- package/src/test-utils/alignedAnsiStyleSerializer.d.ts +9 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js +46 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js.map +1 -0
- package/src/test-utils/config.d.ts +10 -0
- package/src/test-utils/config.js +143 -0
- package/src/test-utils/config.js.map +1 -0
- package/src/test-utils/index.d.ts +10 -0
- package/src/test-utils/index.js +10 -0
- package/src/test-utils/index.js.map +1 -0
- package/src/toThrowMatchers.d.ts +12 -0
- package/src/toThrowMatchers.js +258 -0
- package/src/toThrowMatchers.js.map +1 -0
- package/src/types.d.ts +327 -0
- package/src/types.js +9 -0
- package/src/types.js.map +1 -0
- package/src/utils.d.ts +26 -0
- package/src/utils.js +303 -0
- package/src/utils.js.map +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { printListItems, printObjectProperties } from '../collections';
|
|
8
|
+
const asymmetricMatcher = typeof Symbol === 'function' && Symbol.for
|
|
9
|
+
? Symbol.for('jest.asymmetricMatcher')
|
|
10
|
+
: 0x1357a5;
|
|
11
|
+
const SPACE = ' ';
|
|
12
|
+
export const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
13
|
+
const stringedValue = val.toString();
|
|
14
|
+
if (stringedValue === 'ArrayContaining' ||
|
|
15
|
+
stringedValue === 'ArrayNotContaining') {
|
|
16
|
+
if (++depth > config.maxDepth) {
|
|
17
|
+
return '[' + stringedValue + ']';
|
|
18
|
+
}
|
|
19
|
+
return (stringedValue +
|
|
20
|
+
SPACE +
|
|
21
|
+
'[' +
|
|
22
|
+
printListItems(val.sample, config, indentation, depth, refs, printer) +
|
|
23
|
+
']');
|
|
24
|
+
}
|
|
25
|
+
if (stringedValue === 'ObjectContaining' ||
|
|
26
|
+
stringedValue === 'ObjectNotContaining') {
|
|
27
|
+
if (++depth > config.maxDepth) {
|
|
28
|
+
return '[' + stringedValue + ']';
|
|
29
|
+
}
|
|
30
|
+
return (stringedValue +
|
|
31
|
+
SPACE +
|
|
32
|
+
'{' +
|
|
33
|
+
printObjectProperties(val.sample, config, indentation, depth, refs, printer) +
|
|
34
|
+
'}');
|
|
35
|
+
}
|
|
36
|
+
if (stringedValue === 'StringMatching' ||
|
|
37
|
+
stringedValue === 'StringNotMatching') {
|
|
38
|
+
return (stringedValue +
|
|
39
|
+
SPACE +
|
|
40
|
+
printer(val.sample, config, indentation, depth, refs));
|
|
41
|
+
}
|
|
42
|
+
if (stringedValue === 'StringContaining' ||
|
|
43
|
+
stringedValue === 'StringNotContaining') {
|
|
44
|
+
return (stringedValue +
|
|
45
|
+
SPACE +
|
|
46
|
+
printer(val.sample, config, indentation, depth, refs));
|
|
47
|
+
}
|
|
48
|
+
return val.toAsymmetricMatcher();
|
|
49
|
+
};
|
|
50
|
+
export const test = (val) => val && val.$$typeof === asymmetricMatcher;
|
|
51
|
+
const plugin = { serialize, test };
|
|
52
|
+
export default plugin;
|
|
53
|
+
//# sourceMappingURL=AsymmetricMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsymmetricMatcher.js","sourceRoot":"","sources":["AsymmetricMatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvE,MAAM,iBAAiB,GACnB,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,GAAG;IACtC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC;IACtC,CAAC,CAAC,QAAQ,CAAC;AACnB,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,MAAM,CAAC,MAAM,SAAS,GAA2B,CAC7C,GAAQ,EACR,MAAc,EACd,WAAmB,EACnB,KAAa,EACb,IAAU,EACV,OAAgB,EAClB,EAAE;IACA,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAErC,IACI,aAAa,KAAK,iBAAiB;QACnC,aAAa,KAAK,oBAAoB,EACxC;QACE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE;YAC3B,OAAO,GAAG,GAAG,aAAa,GAAG,GAAG,CAAC;SACpC;QACD,OAAO,CACH,aA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and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare const test: NewPlugin['test'];
|
|
9
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
10
|
+
declare const plugin: NewPlugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=ConvertAnsi.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import ansiRegex from '@casual-simulation/chalk/ansi-regex';
|
|
8
|
+
import style from '@casual-simulation/chalk/ansi-styles';
|
|
9
|
+
const toHumanReadableAnsi = (text) => text.replace(ansiRegex(), (match) => {
|
|
10
|
+
switch (match) {
|
|
11
|
+
case style.red.close:
|
|
12
|
+
case style.green.close:
|
|
13
|
+
case style.cyan.close:
|
|
14
|
+
case style.gray.close:
|
|
15
|
+
case style.white.close:
|
|
16
|
+
case style.yellow.close:
|
|
17
|
+
case style.bgRed.close:
|
|
18
|
+
case style.bgGreen.close:
|
|
19
|
+
case style.bgYellow.close:
|
|
20
|
+
case style.inverse.close:
|
|
21
|
+
case style.dim.close:
|
|
22
|
+
case style.bold.close:
|
|
23
|
+
case style.reset.open:
|
|
24
|
+
case style.reset.close:
|
|
25
|
+
return '</>';
|
|
26
|
+
case style.red.open:
|
|
27
|
+
return '<red>';
|
|
28
|
+
case style.green.open:
|
|
29
|
+
return '<green>';
|
|
30
|
+
case style.cyan.open:
|
|
31
|
+
return '<cyan>';
|
|
32
|
+
case style.gray.open:
|
|
33
|
+
return '<gray>';
|
|
34
|
+
case style.white.open:
|
|
35
|
+
return '<white>';
|
|
36
|
+
case style.yellow.open:
|
|
37
|
+
return '<yellow>';
|
|
38
|
+
case style.bgRed.open:
|
|
39
|
+
return '<bgRed>';
|
|
40
|
+
case style.bgGreen.open:
|
|
41
|
+
return '<bgGreen>';
|
|
42
|
+
case style.bgYellow.open:
|
|
43
|
+
return '<bgYellow>';
|
|
44
|
+
case style.inverse.open:
|
|
45
|
+
return '<inverse>';
|
|
46
|
+
case style.dim.open:
|
|
47
|
+
return '<dim>';
|
|
48
|
+
case style.bold.open:
|
|
49
|
+
return '<bold>';
|
|
50
|
+
default:
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export const test = (val) => typeof val === 'string' && !!val.match(ansiRegex());
|
|
55
|
+
export const serialize = (val, config, indentation, depth, refs, printer) => printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
|
|
56
|
+
const plugin = { serialize, test };
|
|
57
|
+
export default plugin;
|
|
58
|
+
//# sourceMappingURL=ConvertAnsi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConvertAnsi.js","sourceRoot":"","sources":["ConvertAnsi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAAS,MAAM,qCAAqC,CAAC;AAC5D,OAAO,KAAK,MAAM,sCAAsC,CAAC;AAGzD,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,EAAE,CACzC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;IAChC,QAAQ,KAAK,EAAE;QACX,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;QACrB,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QACvB,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QACvB,KAAK,KAAK,CA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pB;YACI,OAAO,EAAE,CAAC;KACjB;AACL,CAAC,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,IAAI,GAAsB,CAAC,GAAY,EAAE,EAAE,CACpD,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,SAAS,GAA2B,CAC7C,GAAW,EACX,MAAc,EACd,WAAmB,EACnB,KAAa,EACb,IAAU,EACV,OAAgB,EAClB,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAEzE,MAAM,MAAM,GAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE9C,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare const test: NewPlugin['test'];
|
|
9
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
10
|
+
declare const plugin: NewPlugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=DOMCollection.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable local/ban-types-eventually */
|
|
8
|
+
import { printListItems, printObjectProperties } from '../collections';
|
|
9
|
+
const SPACE = ' ';
|
|
10
|
+
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
|
|
11
|
+
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
|
12
|
+
const testName = (name) => OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
|
|
13
|
+
export const test = (val) => val &&
|
|
14
|
+
val.constructor &&
|
|
15
|
+
!!val.constructor.name &&
|
|
16
|
+
testName(val.constructor.name);
|
|
17
|
+
const isNamedNodeMap = (collection) => collection.constructor.name === 'NamedNodeMap';
|
|
18
|
+
export const serialize = (collection, config, indentation, depth, refs, printer) => {
|
|
19
|
+
const name = collection.constructor.name;
|
|
20
|
+
if (++depth > config.maxDepth) {
|
|
21
|
+
return '[' + name + ']';
|
|
22
|
+
}
|
|
23
|
+
return ((config.min ? '' : name + SPACE) +
|
|
24
|
+
(OBJECT_NAMES.indexOf(name) !== -1
|
|
25
|
+
? '{' +
|
|
26
|
+
printObjectProperties(isNamedNodeMap(collection)
|
|
27
|
+
? Array.from(collection).reduce((props, attribute) => {
|
|
28
|
+
props[attribute.name] = attribute.value;
|
|
29
|
+
return props;
|
|
30
|
+
}, {})
|
|
31
|
+
: Object.assign({}, collection), config, indentation, depth, refs, printer) +
|
|
32
|
+
'}'
|
|
33
|
+
: '[' +
|
|
34
|
+
printListItems(Array.from(collection), config, indentation, depth, refs, printer) +
|
|
35
|
+
']'));
|
|
36
|
+
};
|
|
37
|
+
const plugin = { serialize, test };
|
|
38
|
+
export default plugin;
|
|
39
|
+
//# sourceMappingURL=DOMCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOMCollection.js","sourceRoot":"","sources":["DOMCollection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+CAA+C;AAE/C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvE,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,MAAM,YAAY,GAAG,CAAC,cAAc,EAAE,cAAc,C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AK,CAAC;wBACxC,OAAO,KAAK,CAAC;oBACjB,CAAC,EACD,EAAE,CACL;oBACH,CAAC,mBAAM,UAAU,CAAE,EACvB,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,OAAO,CACV;gBACD,GAAG;YACL,CAAC,CAAC,GAAG;gBACH,cAAc,CACV,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EACtB,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,OAAO,CACV;gBACD,GAAG,CAAC,CACb,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,MAAM,GAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE9C,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare const test: NewPlugin['test'];
|
|
9
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
10
|
+
declare const plugin: NewPlugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=DOMElement.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { printChildren, printComment, printElement, printElementAsLeaf, printProps, printText, } from './lib/markup';
|
|
8
|
+
const ELEMENT_NODE = 1;
|
|
9
|
+
const TEXT_NODE = 3;
|
|
10
|
+
const COMMENT_NODE = 8;
|
|
11
|
+
const FRAGMENT_NODE = 11;
|
|
12
|
+
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
|
13
|
+
const testHasAttribute = (val) => {
|
|
14
|
+
try {
|
|
15
|
+
return typeof val.hasAttribute === 'function' && val.hasAttribute('is');
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const testNode = (val) => {
|
|
22
|
+
const constructorName = val.constructor.name;
|
|
23
|
+
const { nodeType, tagName } = val;
|
|
24
|
+
const isCustomElement = (typeof tagName === 'string' && tagName.includes('-')) ||
|
|
25
|
+
testHasAttribute(val);
|
|
26
|
+
return ((nodeType === ELEMENT_NODE &&
|
|
27
|
+
(ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
|
|
28
|
+
(nodeType === TEXT_NODE && constructorName === 'Text') ||
|
|
29
|
+
(nodeType === COMMENT_NODE && constructorName === 'Comment') ||
|
|
30
|
+
(nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment'));
|
|
31
|
+
};
|
|
32
|
+
export const test = (val) => { var _a; return ((_a = val === null || val === void 0 ? void 0 : val.constructor) === null || _a === void 0 ? void 0 : _a.name) && testNode(val); };
|
|
33
|
+
function nodeIsText(node) {
|
|
34
|
+
return node.nodeType === TEXT_NODE;
|
|
35
|
+
}
|
|
36
|
+
function nodeIsComment(node) {
|
|
37
|
+
return node.nodeType === COMMENT_NODE;
|
|
38
|
+
}
|
|
39
|
+
function nodeIsFragment(node) {
|
|
40
|
+
return node.nodeType === FRAGMENT_NODE;
|
|
41
|
+
}
|
|
42
|
+
export const serialize = (node, config, indentation, depth, refs, printer) => {
|
|
43
|
+
if (nodeIsText(node)) {
|
|
44
|
+
return printText(node.data, config);
|
|
45
|
+
}
|
|
46
|
+
if (nodeIsComment(node)) {
|
|
47
|
+
return printComment(node.data, config);
|
|
48
|
+
}
|
|
49
|
+
const type = nodeIsFragment(node)
|
|
50
|
+
? `DocumentFragment`
|
|
51
|
+
: node.tagName.toLowerCase();
|
|
52
|
+
if (++depth > config.maxDepth) {
|
|
53
|
+
return printElementAsLeaf(type, config);
|
|
54
|
+
}
|
|
55
|
+
return printElement(type, printProps(nodeIsFragment(node)
|
|
56
|
+
? []
|
|
57
|
+
: Array.from(node.attributes)
|
|
58
|
+
.map((attr) => attr.name)
|
|
59
|
+
.sort(), nodeIsFragment(node)
|
|
60
|
+
? {}
|
|
61
|
+
: Array.from(node.attributes).reduce((props, attribute) => {
|
|
62
|
+
props[attribute.name] = attribute.value;
|
|
63
|
+
return props;
|
|
64
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
65
|
+
};
|
|
66
|
+
const plugin = { serialize, test };
|
|
67
|
+
export default plugin;
|
|
68
|
+
//# sourceMappingURL=DOMElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOMElement.js","sourceRoot":"","sources":["DOMElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACH,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,SAAS,GACZ,MAAM,cAAc,CAAC;AAEtB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAE,EAAE;IAClC,IAAI;QACA,OAAO,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;KAC3E;IAAC,WAAM;QACJ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC1B,MAAM,eAAe,GAAG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ACL,IAAI,EACJ,OAAO,CACV,EACD,MAAM,EACN,WAAW,CACd,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,MAAM,GAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE9C,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
9
|
+
export declare const test: NewPlugin['test'];
|
|
10
|
+
declare const plugin: NewPlugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=Immutable.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { printIteratorEntries, printIteratorValues } from '../collections';
|
|
8
|
+
// SENTINEL constants are from https://github.com/facebook/immutable-js
|
|
9
|
+
const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
10
|
+
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
|
11
|
+
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
|
12
|
+
const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
|
|
13
|
+
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
|
14
|
+
const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
|
|
15
|
+
const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
|
|
16
|
+
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
|
17
|
+
const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
|
|
18
|
+
const getImmutableName = (name) => 'Immutable.' + name;
|
|
19
|
+
const printAsLeaf = (name) => '[' + name + ']';
|
|
20
|
+
const SPACE = ' ';
|
|
21
|
+
const LAZY = '…'; // Seq is lazy if it calls a method like filter
|
|
22
|
+
const printImmutableEntries = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth
|
|
23
|
+
? printAsLeaf(getImmutableName(type))
|
|
24
|
+
: getImmutableName(type) +
|
|
25
|
+
SPACE +
|
|
26
|
+
'{' +
|
|
27
|
+
printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) +
|
|
28
|
+
'}';
|
|
29
|
+
// Record has an entries method because it is a collection in immutable v3.
|
|
30
|
+
// Return an iterator for Immutable Record from version v3 or v4.
|
|
31
|
+
function getRecordEntries(val) {
|
|
32
|
+
let i = 0;
|
|
33
|
+
return {
|
|
34
|
+
next() {
|
|
35
|
+
if (i < val._keys.length) {
|
|
36
|
+
const key = val._keys[i++];
|
|
37
|
+
return { done: false, value: [key, val.get(key)] };
|
|
38
|
+
}
|
|
39
|
+
return { done: true, value: undefined };
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const printImmutableRecord = (val, config, indentation, depth, refs, printer) => {
|
|
44
|
+
// _name property is defined only for an Immutable Record instance
|
|
45
|
+
// which was constructed with a second optional descriptive name arg
|
|
46
|
+
const name = getImmutableName(val._name || 'Record');
|
|
47
|
+
return ++depth > config.maxDepth
|
|
48
|
+
? printAsLeaf(name)
|
|
49
|
+
: name +
|
|
50
|
+
SPACE +
|
|
51
|
+
'{' +
|
|
52
|
+
printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer) +
|
|
53
|
+
'}';
|
|
54
|
+
};
|
|
55
|
+
const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
|
|
56
|
+
const name = getImmutableName('Seq');
|
|
57
|
+
if (++depth > config.maxDepth) {
|
|
58
|
+
return printAsLeaf(name);
|
|
59
|
+
}
|
|
60
|
+
if (val[IS_KEYED_SENTINEL]) {
|
|
61
|
+
return (name +
|
|
62
|
+
SPACE +
|
|
63
|
+
'{' +
|
|
64
|
+
// from Immutable collection of entries or from ECMAScript object
|
|
65
|
+
(val._iter || val._object
|
|
66
|
+
? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer)
|
|
67
|
+
: LAZY) +
|
|
68
|
+
'}');
|
|
69
|
+
}
|
|
70
|
+
return (name +
|
|
71
|
+
SPACE +
|
|
72
|
+
'[' +
|
|
73
|
+
(val._iter || // from Immutable collection of values
|
|
74
|
+
val._array || // from ECMAScript array
|
|
75
|
+
val._collection || // from ECMAScript collection in immutable v4
|
|
76
|
+
val._iterable // from ECMAScript collection in immutable v3
|
|
77
|
+
? printIteratorValues(val.values(), config, indentation, depth, refs, printer)
|
|
78
|
+
: LAZY) +
|
|
79
|
+
']');
|
|
80
|
+
};
|
|
81
|
+
const printImmutableValues = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth
|
|
82
|
+
? printAsLeaf(getImmutableName(type))
|
|
83
|
+
: getImmutableName(type) +
|
|
84
|
+
SPACE +
|
|
85
|
+
'[' +
|
|
86
|
+
printIteratorValues(val.values(), config, indentation, depth, refs, printer) +
|
|
87
|
+
']';
|
|
88
|
+
export const serialize = (val, config, indentation, depth, refs, printer) => {
|
|
89
|
+
if (val[IS_MAP_SENTINEL]) {
|
|
90
|
+
return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
|
|
91
|
+
}
|
|
92
|
+
if (val[IS_LIST_SENTINEL]) {
|
|
93
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
|
|
94
|
+
}
|
|
95
|
+
if (val[IS_SET_SENTINEL]) {
|
|
96
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
|
|
97
|
+
}
|
|
98
|
+
if (val[IS_STACK_SENTINEL]) {
|
|
99
|
+
return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
|
|
100
|
+
}
|
|
101
|
+
if (val[IS_SEQ_SENTINEL]) {
|
|
102
|
+
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
|
103
|
+
}
|
|
104
|
+
// For compatibility with immutable v3 and v4, let record be the default.
|
|
105
|
+
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
|
106
|
+
};
|
|
107
|
+
// Explicitly comparing sentinel properties to true avoids false positive
|
|
108
|
+
// when mock identity-obj-proxy returns the key as the value for any key.
|
|
109
|
+
export const test = (val) => val &&
|
|
110
|
+
(val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
111
|
+
const plugin = { serialize, test };
|
|
112
|
+
export default plugin;
|
|
113
|
+
//# sourceMappingURL=Immutable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Immutable.js","sourceRoot":"","sources":["Immutable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG3E,uEAAuE;AACvE,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAC1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAClD,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AACxD,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,CAAC,eAAe;AACtE,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,MAAM,gBAAgB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C,mBAAmB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAClD,CAAC;KACL;IACD,IAAI,GAAG,CAAC,iBAAiB,CAAC,EAAE;QACxB,OAAO,oBAAoB,CACvB,GAAG,EACH,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,OAAO,EACP,OAAO,CACV,CAAC;KACL;IAED,IAAI,GAAG,CAAC,eAAe,CAAC,EAAE;QACtB,OAAO,iBAAiB,CACpB,GAAG,EACH,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,OAAO,CACV,CAAC;KACL;IAED,yEAAyE;IACzE,OAAO,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChF,CAAC,CAAC;AAEF,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,MAAM,IAAI,GAAsB,CAAC,GAAQ,EAAE,EAAE,CAChD,GAAG;IACH,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC,CAAC;AAE7E,MAAM,MAAM,GAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE9C,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare type ReactTestObject = {
|
|
9
|
+
$$typeof: symbol;
|
|
10
|
+
type: string;
|
|
11
|
+
props?: Record<string, unknown>;
|
|
12
|
+
children?: null | Array<ReactTestChild>;
|
|
13
|
+
};
|
|
14
|
+
declare type ReactTestChild = ReactTestObject | string | number;
|
|
15
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
16
|
+
export declare const test: NewPlugin['test'];
|
|
17
|
+
declare const plugin: NewPlugin;
|
|
18
|
+
export default plugin;
|
|
19
|
+
//# sourceMappingURL=ReactTestComponent.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { printChildren, printElement, printElementAsLeaf, printProps, } from './lib/markup';
|
|
8
|
+
const testSymbol = typeof Symbol === 'function' && Symbol.for
|
|
9
|
+
? Symbol.for('react.test.json')
|
|
10
|
+
: 0xea71357;
|
|
11
|
+
const getPropKeys = (object) => {
|
|
12
|
+
const { props } = object;
|
|
13
|
+
return props
|
|
14
|
+
? Object.keys(props)
|
|
15
|
+
.filter((key) => props[key] !== undefined)
|
|
16
|
+
.sort()
|
|
17
|
+
: [];
|
|
18
|
+
};
|
|
19
|
+
export const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth
|
|
20
|
+
? printElementAsLeaf(object.type, config)
|
|
21
|
+
: printElement(object.type, object.props
|
|
22
|
+
? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer)
|
|
23
|
+
: '', object.children
|
|
24
|
+
? printChildren(object.children, config, indentation + config.indent, depth, refs, printer)
|
|
25
|
+
: '', config, indentation);
|
|
26
|
+
export const test = (val) => val && val.$$typeof === testSymbol;
|
|
27
|
+
const plugin = { serialize, test };
|
|
28
|
+
export default plugin;
|
|
29
|
+
//# sourceMappingURL=ReactTestComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactTestComponent.js","sourceRoot":"","sources":["ReactTestComponent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACH,aAAa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,WAAW,CACd,CAAC;AAEZ,MAAM,CAAC,MAAM,IAAI,GAAsB,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU,CAAC;AAEvC,MAAM,MAAM,GAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE9C,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export default function escapeHTML(str: string): string;
|
|
8
|
+
//# sourceMappingURL=escapeHTML.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export default function escapeHTML(str) {
|
|
8
|
+
return str.replace(/</g, '<').replace(/>/g, '>');
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=escapeHTML.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escapeHTML.js","sourceRoot":"","sources":["escapeHTML.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,GAAW;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { Config, Printer, Refs } from '../../types';
|
|
8
|
+
export declare const printProps: (keys: Array<string>, props: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
|
9
|
+
export declare const printChildren: (children: Array<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
|
10
|
+
export declare const printText: (text: string, config: Config) => string;
|
|
11
|
+
export declare const printComment: (comment: string, config: Config) => string;
|
|
12
|
+
export declare const printElement: (type: string, printedProps: string, printedChildren: string, config: Config, indentation: string) => string;
|
|
13
|
+
export declare const printElementAsLeaf: (type: string, config: Config) => string;
|
|
14
|
+
//# sourceMappingURL=markup.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import escapeHTML from './escapeHTML';
|
|
8
|
+
// Return empty string if keys is empty.
|
|
9
|
+
export const printProps = (keys, props, config, indentation, depth, refs, printer) => {
|
|
10
|
+
const indentationNext = indentation + config.indent;
|
|
11
|
+
const colors = config.colors;
|
|
12
|
+
return keys
|
|
13
|
+
.map((key) => {
|
|
14
|
+
const value = props[key];
|
|
15
|
+
let printed = printer(value, config, indentationNext, depth, refs);
|
|
16
|
+
if (typeof value !== 'string') {
|
|
17
|
+
if (printed.indexOf('\n') !== -1) {
|
|
18
|
+
printed =
|
|
19
|
+
config.spacingOuter +
|
|
20
|
+
indentationNext +
|
|
21
|
+
printed +
|
|
22
|
+
config.spacingOuter +
|
|
23
|
+
indentation;
|
|
24
|
+
}
|
|
25
|
+
printed = '{' + printed + '}';
|
|
26
|
+
}
|
|
27
|
+
return (config.spacingInner +
|
|
28
|
+
indentation +
|
|
29
|
+
colors.prop.open +
|
|
30
|
+
key +
|
|
31
|
+
colors.prop.close +
|
|
32
|
+
'=' +
|
|
33
|
+
colors.value.open +
|
|
34
|
+
printed +
|
|
35
|
+
colors.value.close);
|
|
36
|
+
})
|
|
37
|
+
.join('');
|
|
38
|
+
};
|
|
39
|
+
// Return empty string if children is empty.
|
|
40
|
+
export const printChildren = (children, config, indentation, depth, refs, printer) => children
|
|
41
|
+
.map((child) => config.spacingOuter +
|
|
42
|
+
indentation +
|
|
43
|
+
(typeof child === 'string'
|
|
44
|
+
? printText(child, config)
|
|
45
|
+
: printer(child, config, indentation, depth, refs)))
|
|
46
|
+
.join('');
|
|
47
|
+
export const printText = (text, config) => {
|
|
48
|
+
const contentColor = config.colors.content;
|
|
49
|
+
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
50
|
+
};
|
|
51
|
+
export const printComment = (comment, config) => {
|
|
52
|
+
const commentColor = config.colors.comment;
|
|
53
|
+
return (commentColor.open +
|
|
54
|
+
'<!--' +
|
|
55
|
+
escapeHTML(comment) +
|
|
56
|
+
'-->' +
|
|
57
|
+
commentColor.close);
|
|
58
|
+
};
|
|
59
|
+
// Separate the functions to format props, children, and element,
|
|
60
|
+
// so a plugin could override a particular function, if needed.
|
|
61
|
+
// Too bad, so sad: the traditional (but unnecessary) space
|
|
62
|
+
// in a self-closing tagColor requires a second test of printedProps.
|
|
63
|
+
export const printElement = (type, printedProps, printedChildren, config, indentation) => {
|
|
64
|
+
const tagColor = config.colors.tag;
|
|
65
|
+
return (tagColor.open +
|
|
66
|
+
'<' +
|
|
67
|
+
type +
|
|
68
|
+
(printedProps &&
|
|
69
|
+
tagColor.close +
|
|
70
|
+
printedProps +
|
|
71
|
+
config.spacingOuter +
|
|
72
|
+
indentation +
|
|
73
|
+
tagColor.open) +
|
|
74
|
+
(printedChildren
|
|
75
|
+
? '>' +
|
|
76
|
+
tagColor.close +
|
|
77
|
+
printedChildren +
|
|
78
|
+
config.spacingOuter +
|
|
79
|
+
indentation +
|
|
80
|
+
tagColor.open +
|
|
81
|
+
'</' +
|
|
82
|
+
type
|
|
83
|
+
: (printedProps && !config.min ? '' : ' ') + '/') +
|
|
84
|
+
'>' +
|
|
85
|
+
tagColor.close);
|
|
86
|
+
};
|
|
87
|
+
export const printElementAsLeaf = (type, config) => {
|
|
88
|
+
const tagColor = config.colors.tag;
|
|
89
|
+
return (tagColor.open +
|
|
90
|
+
'<' +
|
|
91
|
+
type +
|
|
92
|
+
tagColor.close +
|
|
93
|
+
' …' +
|
|
94
|
+
tagColor.open +
|
|
95
|
+
' />' +
|
|
96
|
+
tagColor.close);
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=markup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markup.js","sourceRoot":"","sources":["markup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,wCAAwC;AACxC,MAAM,CAAC,MAAM,UAAU,GAAG,CACtB,IAAmB,EACnB,KAA8B,EAC9B,MAAc,EACd,WAAmB,EACnB,KAAa,EACb,IAAU,EACV,OAAgB,EACV,EAAE;IACR,MAAM,eAAe,GAAG,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,OAAO,IAAI;SACN,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACT,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAEnE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC9B,OAAO;oBACH,MAAM,CAAC,YAAY;wBACnB,eAAe;w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