@knapsack/renderer-react 4.71.19--canary.5325.d5f1abb.0 → 4.71.19--canary.5222.4f720ff.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/dist/analyze/index.d.mts +2 -0
  2. package/dist/analyze/index.d.mts.map +1 -0
  3. package/dist/analyze/index.mjs +2 -0
  4. package/dist/analyze/index.mjs.map +1 -0
  5. package/dist/analyze/infer-spec-fixtures/components.d.ts +99 -0
  6. package/dist/analyze/infer-spec-fixtures/components.d.ts.map +1 -0
  7. package/dist/analyze/infer-spec-fixtures/components.js +59 -0
  8. package/dist/analyze/infer-spec-fixtures/components.js.map +1 -0
  9. package/dist/analyze/infer-spec-fixtures/index.d.mts +2 -0
  10. package/dist/analyze/infer-spec-fixtures/index.d.mts.map +1 -0
  11. package/dist/analyze/infer-spec-fixtures/index.mjs +2 -0
  12. package/dist/analyze/infer-spec-fixtures/index.mjs.map +1 -0
  13. package/dist/analyze/infer-spec.d.mts +27 -0
  14. package/dist/analyze/infer-spec.d.mts.map +1 -0
  15. package/dist/analyze/infer-spec.mjs +98 -0
  16. package/dist/analyze/infer-spec.mjs.map +1 -0
  17. package/dist/analyze/infer-spec.test.d.mts +2 -0
  18. package/dist/analyze/infer-spec.test.d.mts.map +1 -0
  19. package/dist/analyze/infer-spec.test.mjs +217 -0
  20. package/dist/analyze/infer-spec.test.mjs.map +1 -0
  21. package/dist/analyze/mui.test.d.mts +2 -0
  22. package/dist/analyze/mui.test.d.mts.map +1 -0
  23. package/dist/analyze/mui.test.mjs +88 -0
  24. package/dist/analyze/mui.test.mjs.map +1 -0
  25. package/dist/analyze/pkg-basic.test.d.mts +2 -0
  26. package/dist/analyze/pkg-basic.test.d.mts.map +1 -0
  27. package/dist/analyze/pkg-basic.test.mjs +28 -0
  28. package/dist/analyze/pkg-basic.test.mjs.map +1 -0
  29. package/dist/analyze/pkg-diff-types.test.d.mts +2 -0
  30. package/dist/analyze/pkg-diff-types.test.d.mts.map +1 -0
  31. package/dist/analyze/pkg-diff-types.test.mjs +29 -0
  32. package/dist/analyze/pkg-diff-types.test.mjs.map +1 -0
  33. package/dist/analyze/utils/importer.d.mts +17 -0
  34. package/dist/analyze/utils/importer.d.mts.map +1 -0
  35. package/dist/analyze/utils/importer.mjs +80 -0
  36. package/dist/analyze/utils/importer.mjs.map +1 -0
  37. package/dist/analyze/utils/react-component-analyzer.d.mts +24 -0
  38. package/dist/analyze/utils/react-component-analyzer.d.mts.map +1 -0
  39. package/dist/analyze/utils/react-component-analyzer.mjs +154 -0
  40. package/dist/analyze/utils/react-component-analyzer.mjs.map +1 -0
  41. package/dist/renderer-react.d.ts.map +1 -1
  42. package/dist/renderer-react.js +9 -8
  43. package/dist/renderer-react.js.map +1 -1
  44. package/package.json +16 -14
  45. package/turbo.json +9 -0
  46. package/dist/analyze/infer-spec.test.d.ts +0 -2
  47. package/dist/analyze/infer-spec.test.d.ts.map +0 -1
  48. package/dist/analyze/infer-spec.test.js +0 -112
  49. package/dist/analyze/infer-spec.test.js.map +0 -1
  50. package/dist/analyze/mui.test.d.ts +0 -2
  51. package/dist/analyze/mui.test.d.ts.map +0 -1
  52. package/dist/analyze/mui.test.js +0 -60
  53. package/dist/analyze/mui.test.js.map +0 -1
  54. package/dist/analyze/pkg-basic.test.d.ts +0 -2
  55. package/dist/analyze/pkg-basic.test.d.ts.map +0 -1
  56. package/dist/analyze/pkg-basic.test.js +0 -33
  57. package/dist/analyze/pkg-basic.test.js.map +0 -1
  58. package/dist/analyze/pkg-diff-types.test.d.ts +0 -2
  59. package/dist/analyze/pkg-diff-types.test.d.ts.map +0 -1
  60. package/dist/analyze/pkg-diff-types.test.js +0 -43
  61. package/dist/analyze/pkg-diff-types.test.js.map +0 -1
  62. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knapsack/renderer-react",
3
3
  "description": "Render React",
4
- "version": "4.71.19--canary.5325.d5f1abb.0",
4
+ "version": "4.71.19--canary.5222.4f720ff.0",
5
5
  "type": "commonjs",
6
6
  "exports": {
7
7
  ".": {
@@ -31,14 +31,15 @@
31
31
  "author": "Knapsack",
32
32
  "dependencies": {
33
33
  "@babel/preset-react": "^7.25.9",
34
- "@knapsack/app": "4.71.19--canary.5325.d5f1abb.0",
35
- "@knapsack/creator-utils": "4.71.19--canary.5325.d5f1abb.0",
36
- "@knapsack/file-utils": "4.71.19--canary.5325.d5f1abb.0",
37
- "@knapsack/ks-file-utils": "4.71.19--canary.5325.d5f1abb.0",
38
- "@knapsack/renderer-react-components": "4.71.19--canary.5325.d5f1abb.0",
39
- "@knapsack/renderer-webpack-base": "4.71.19--canary.5325.d5f1abb.0",
40
- "@knapsack/types": "4.71.19--canary.5325.d5f1abb.0",
41
- "@knapsack/utils": "4.71.19--canary.5325.d5f1abb.0",
34
+ "@knapsack/app": "4.71.19--canary.5222.4f720ff.0",
35
+ "@knapsack/creator-utils": "4.71.19--canary.5222.4f720ff.0",
36
+ "@knapsack/file-utils": "4.71.19--canary.5222.4f720ff.0",
37
+ "@knapsack/ks-file-utils": "4.71.19--canary.5222.4f720ff.0",
38
+ "@knapsack/renderer-react-components": "4.71.19--canary.5222.4f720ff.0",
39
+ "@knapsack/renderer-webpack-base": "4.71.19--canary.5222.4f720ff.0",
40
+ "@knapsack/spec-utils": "4.71.19--canary.5222.4f720ff.0",
41
+ "@knapsack/types": "4.71.19--canary.5222.4f720ff.0",
42
+ "@knapsack/utils": "4.71.19--canary.5222.4f720ff.0",
42
43
  "react": "^18.3.1",
43
44
  "react-docgen": "^6.0.4",
44
45
  "react-docgen-typescript": "^2.2.2",
@@ -47,10 +48,11 @@
47
48
  "typescript": "^5.6.3"
48
49
  },
49
50
  "devDependencies": {
50
- "@knapsack/eslint-config-starter": "4.71.19--canary.5325.d5f1abb.0",
51
- "@knapsack/sandbox-components": "4.71.19--canary.5325.d5f1abb.0",
52
- "@knapsack/test-ava": "4.71.19--canary.5325.d5f1abb.0",
53
- "@knapsack/typescript-config-starter": "4.71.19--canary.5325.d5f1abb.0",
51
+ "@knapsack/eslint-config-starter": "4.71.19--canary.5222.4f720ff.0",
52
+ "@knapsack/sandbox-components": "4.71.19--canary.5222.4f720ff.0",
53
+ "@knapsack/test-ava": "4.71.19--canary.5222.4f720ff.0",
54
+ "@knapsack/toby": "4.71.19--canary.5222.4f720ff.0",
55
+ "@knapsack/typescript-config-starter": "4.71.19--canary.5222.4f720ff.0",
54
56
  "@mui/material": "^5.16.7",
55
57
  "@mui/x-data-grid": "^6.20.4",
56
58
  "@types/node": "^20.17.8",
@@ -68,5 +70,5 @@
68
70
  "directory": "apps/client/renderers/renderer-react",
69
71
  "type": "git"
70
72
  },
71
- "gitHead": "d5f1abb1a2e7d8f880c3abd974a9272632a675ea"
73
+ "gitHead": "4f720ffcd266750b90019095b7928279145eab4f"
72
74
  }
package/turbo.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://turbo.build/schema.json",
3
+ "extends": ["//"],
4
+ "tasks": {
5
+ "build": {
6
+ "outputs": ["dist/**"]
7
+ }
8
+ }
9
+ }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=infer-spec.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infer-spec.test.d.ts","sourceRoot":"","sources":["../../src/analyze/infer-spec.test.ts"],"names":[],"mappings":""}
@@ -1,112 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ava_1 = __importDefault(require("ava"));
7
- const types_1 = require("@knapsack/types");
8
- const renderers_1 = require("@knapsack/app/renderers");
9
- const utils_1 = require("../utils");
10
- (0, ava_1.default)('infer types in packages with different files name for types', async (t) => {
11
- const spec = await (0, utils_1.getReactDocs)({
12
- src: '@knapsack/sandbox-components/react',
13
- exportName: 'Button',
14
- resolveFromDir: __dirname,
15
- });
16
- if (spec === false) {
17
- t.fail(`Spec could not be inferred`);
18
- return;
19
- }
20
- t.truthy(spec);
21
- t.deepEqual(Object.keys(spec.props.properties).sort(), ['label', 'mode', 'size', 'type'].sort());
22
- if ((0, types_1.isOptionsProp)(spec.props.properties.size)) {
23
- t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
24
- }
25
- else {
26
- t.log(spec.props.properties.size);
27
- t.fail(`size prop should be an options prop`);
28
- }
29
- if ((0, types_1.isOptionsProp)(spec.props.properties.type)) {
30
- t.deepEqual(spec.props.properties.type.enum, ['filled', 'outlined']);
31
- }
32
- else {
33
- t.log(spec.props.properties.type);
34
- t.fail(`type prop should be an options prop`);
35
- }
36
- if ((0, types_1.isOptionsProp)(spec.props.properties.mode)) {
37
- t.deepEqual(spec.props.properties.mode.enum, [
38
- 'default',
39
- 'success',
40
- 'error',
41
- 'warning',
42
- ]);
43
- }
44
- else {
45
- t.log(spec.props.properties.mode);
46
- t.fail(`mode prop should be an options prop`);
47
- }
48
- });
49
- (0, ava_1.default)('inferDocs card.tsx with types', async (t) => {
50
- const spec = await (0, utils_1.getReactDocs)({
51
- src: '@knapsack/renderer-react-components/test-fixtures',
52
- exportName: 'Card',
53
- resolveFromDir: process.cwd(),
54
- });
55
- const expectedSpec = {
56
- props: {
57
- $schema: 'http://json-schema.org/draft-07/schema',
58
- type: 'object',
59
- required: ['cardBody', 'items'],
60
- properties: {
61
- textAlign: {
62
- type: 'string',
63
- enum: ['left', 'center', 'right'],
64
- // @todo We lost proper default value when the source switched from `.tsx` to being from a package, which results in analyzing a `.d.ts` files... which doesn't have default values.
65
- // default: 'left',
66
- default: undefined,
67
- },
68
- imgSrc: {
69
- type: 'string',
70
- },
71
- isDark: {
72
- type: 'boolean',
73
- // @todo We lost proper default value when the source switched from `.tsx` to being from a package, which results in analyzing a `.d.ts` files... which doesn't have default values.
74
- // default: true,
75
- },
76
- cardTitle: {
77
- type: 'string',
78
- },
79
- cardSubTitle: {
80
- type: 'string',
81
- },
82
- cardBody: {
83
- type: 'string',
84
- },
85
- handleIt: {
86
- typeof: 'function',
87
- tsType: '(x: string) => boolean',
88
- },
89
- items: {
90
- tsType: '{ id: string; title: string; description?: string; }[]',
91
- },
92
- },
93
- },
94
- slots: {
95
- children: {
96
- description: 'Goes in footer',
97
- title: 'children',
98
- },
99
- header: {
100
- title: 'header',
101
- },
102
- },
103
- };
104
- if (spec === false) {
105
- t.fail('Spec could not be inferred');
106
- return;
107
- }
108
- const { ok, message } = (0, renderers_1.validateSpec)(spec);
109
- t.is(ok, true, message);
110
- t.deepEqual(spec, expectedSpec);
111
- });
112
- //# sourceMappingURL=infer-spec.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infer-spec.test.js","sourceRoot":"","sources":["../../src/analyze/infer-spec.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,2CAAgE;AAChE,uDAAuD;AACvD,oCAAwC;AAExC,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,oCAAoC;QACzC,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC,SAAS,CACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACzC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CACzC,CAAC;IACF,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,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Y,EAAC,IAAI,CAAC,CAAC;IAE3C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mui.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mui.test.d.ts","sourceRoot":"","sources":["../../src/analyze/mui.test.ts"],"names":[],"mappings":""}
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ava_1 = __importDefault(require("ava"));
7
- const types_1 = require("@knapsack/types");
8
- const utils_1 = require("../utils");
9
- ava_1.default.serial('MUI strings with extra quotes', async (t) => {
10
- const results = await (0, utils_1.getReactDocs)({
11
- src: '@mui/x-data-grid',
12
- exportName: 'DataGrid',
13
- resolveFromDir: process.cwd(),
14
- });
15
- if (results === false) {
16
- t.fail('Could not infer spec');
17
- return;
18
- }
19
- Object.entries(results.props.properties).forEach(([propName, prop]) => {
20
- if ((0, types_1.isStringProp)(prop) || (0, types_1.isOptionsProp)(prop)) {
21
- if (typeof prop.default === 'string') {
22
- t.true(!prop.default.startsWith('"') && !prop.default.endsWith('"'), `prop "${propName}" has a default that should not be quoted: ${prop.default} - ${JSON.stringify(prop)}`);
23
- }
24
- }
25
- if ((0, types_1.isOptionsProp)(prop)) {
26
- if (prop.default) {
27
- t.true(prop.enum.includes(prop.default), `For prop "${propName}", the default value "${prop.default}" is not in the enum: ${prop.enum}`);
28
- }
29
- prop.enum.forEach((option) => {
30
- t.true(!option.startsWith('"') && !option.endsWith('"'), `option should not be quoted: ${prop.default}`);
31
- });
32
- }
33
- if ((0, types_1.isNumberProp)(prop) && prop.default) {
34
- const ok = t.is(typeof prop.default, 'number', `prop "${propName}" default should be a number: ${prop.default}`);
35
- if (!ok) {
36
- t.log(prop);
37
- }
38
- }
39
- if ((0, types_1.isBooleanProp)(prop) && prop.default) {
40
- const ok = t.is(typeof prop.default, 'boolean', `prop "${propName}" should be a boolean: ${prop.default}`);
41
- if (!ok) {
42
- t.log(prop);
43
- }
44
- }
45
- });
46
- });
47
- ava_1.default.failing('infer types for MUI Component', async (t) => {
48
- const spec = await (0, utils_1.getReactDocs)({
49
- src: '@mui/material',
50
- exportName: 'Button',
51
- resolveFromDir: process.cwd(),
52
- });
53
- if (spec === false) {
54
- t.fail('Spec could not be inferred for MUI Component');
55
- }
56
- else {
57
- t.pass('Spec was successfully inferred for MUI Component');
58
- }
59
- });
60
- //# sourceMappingURL=mui.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mui.test.js","sourceRoot":"","sources":["../../src/analyze/mui.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,2CAKyB;AACzB,oCAAwC;AAExC,aAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvD,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAY,EAAC;QACjC,GAAG,EAAE,kBAAkB;QACvB,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE;KAC9B,CAAC,CAAC;IACH,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IACD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;QACpE,IAAI,IAAA,oBAAY,EAAC,IAAI,CAAC,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,IAAI,OAAO,IAAI,CAAC,OAA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AI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACxC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CACb,OAAO,IAAI,CAAC,OAAO,EACnB,SAAS,EACT,SAAS,QAAQ,0BAA0B,IAAI,CAAC,OAAO,EAAE,CAC1D,CAAC;YACF,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACxD,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,eAAe;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE;KAC9B,CAAC,CAAC;IAEH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,CAAC,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pkg-basic.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pkg-basic.test.d.ts","sourceRoot":"","sources":["../../src/analyze/pkg-basic.test.ts"],"names":[],"mappings":""}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ava_1 = __importDefault(require("ava"));
7
- const types_1 = require("@knapsack/types");
8
- const utils_1 = require("../utils");
9
- (0, ava_1.default)('infer types in basic packages', async (t) => {
10
- const spec = await (0, utils_1.getReactDocs)({
11
- src: '@knapsack/renderer-react-components/test-fixtures',
12
- exportName: 'Button',
13
- resolveFromDir: __dirname,
14
- });
15
- if (spec === false) {
16
- t.fail(`Spec could not be inferred`);
17
- return;
18
- }
19
- t.deepEqual(Object.keys(spec.props.properties).sort(), ['size', 'text'].sort());
20
- if (!(0, types_1.isStringProp)(spec.props.properties.text)) {
21
- t.log(spec.props.properties.text);
22
- t.fail(`text prop should be a string`);
23
- return;
24
- }
25
- if (!(0, types_1.isOptionsProp)(spec.props.properties.size)) {
26
- t.log(spec.props.properties.size);
27
- t.fail(`size prop should be an options prop`);
28
- return;
29
- }
30
- t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
31
- t.is(spec.slots.children.title, 'children', `Should detect "children" slot`);
32
- });
33
- //# sourceMappingURL=pkg-basic.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pkg-basic.test.js","sourceRoot":"","sources":["../../src/analyze/pkg-basic.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,2CAA8D;AAC9D,oCAAwC;AAExC,IAAA,aAAI,EAAC,+BAA+B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,mDAAmD;QACxD,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IACD,CAAC,CAAC,SAAS,CACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACzC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CACxB,CAAC;IACF,IAAI,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IACD,IAAI,CAAC,IAAA,qBAAa,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,+BAA+B,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pkg-diff-types.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pkg-diff-types.test.d.ts","sourceRoot":"","sources":["../../src/analyze/pkg-diff-types.test.ts"],"names":[],"mappings":""}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ava_1 = __importDefault(require("ava"));
7
- const path_1 = require("path");
8
- const types_1 = require("@knapsack/types");
9
- const utils_1 = require("../utils");
10
- (0, ava_1.default)('infer types in packages with different files name for types', async (t) => {
11
- const spec = await (0, utils_1.getReactDocs)({
12
- src: (0, path_1.join)(__dirname, '../../test-fixtures/pkg-diff-types'),
13
- exportName: 'Button',
14
- resolveFromDir: __dirname,
15
- });
16
- if (spec === false) {
17
- t.fail(`Spec could not be inferred`);
18
- return;
19
- }
20
- t.truthy(spec);
21
- if (!spec.props) {
22
- t.fail(`Spec should have props`);
23
- return;
24
- }
25
- if (!spec.slots) {
26
- t.fail(`Spec should have slots`);
27
- return;
28
- }
29
- t.deepEqual(Object.keys(spec.props.properties).sort(), ['size', 'text'].sort());
30
- if (!(0, types_1.isStringProp)(spec.props.properties.text)) {
31
- t.log(spec.props.properties.text);
32
- t.fail(`text prop should be a string`);
33
- return;
34
- }
35
- if (!(0, types_1.isOptionsProp)(spec.props.properties.size)) {
36
- t.log(spec.props.properties.size);
37
- t.fail(`size prop should be an options prop`);
38
- return;
39
- }
40
- t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
41
- t.is(spec.slots.children.title, 'children', `Should detect "children" slot`);
42
- });
43
- //# sourceMappingURL=pkg-diff-types.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pkg-diff-types.test.js","sourceRoot":"","sources":["../../src/analyze/pkg-diff-types.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,+BAA4B;AAC5B,2CAA8D;AAC9D,oCAAwC;AAExC,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,oCAAoC,CAAC;QAC1D,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IACD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC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