crankscript 0.5.1 → 0.6.0
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/package.json +1 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +1 -0
- package/src/commands/GenerateTypes/GenerateTypesCommand.js +5 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +2 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.js +11 -5
- package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
- package/src/commands/GenerateTypes/fn/generateFunction.d.ts +4 -0
- package/src/commands/GenerateTypes/fn/generateFunction.js +28 -0
- package/src/commands/GenerateTypes/fn/generateFunction.js.map +1 -0
- package/src/commands/GenerateTypes/fn/generateNamespace.d.ts +4 -3
- package/src/commands/GenerateTypes/fn/generateNamespace.js +68 -21
- package/src/commands/GenerateTypes/fn/generateNamespace.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +2 -11
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js +26 -9
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.d.ts +5 -0
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js +75 -0
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js.map +1 -0
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +4 -6
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +2 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +14 -23
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +10 -0
- package/src/commands/GenerateTypes/hooks/useGetVersion.js +5 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +0 -9
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +3 -3
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -1
- package/src/commands/GenerateTypes/utils/createTypeProvider.d.ts +12 -0
- package/src/commands/GenerateTypes/utils/createTypeProvider.js +141 -0
- package/src/commands/GenerateTypes/utils/createTypeProvider.js.map +1 -0
- package/src/components/CheckList/CheckList.js +1 -2
- package/src/components/CheckList/CheckList.js.map +1 -1
- package/src/components/CheckList/Item.js +1 -0
- package/src/components/CheckList/Item.js.map +1 -1
- package/src/constants.d.ts +2 -0
- package/src/constants.js +4 -0
- package/src/constants.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/types.d.ts +34 -3
- package/src/types.js.map +1 -1
- package/src/utils/dirname.d.ts +1 -1
- package/src/utils/dirname.js +2 -3
- package/src/utils/dirname.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.d.ts +0 -2
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js +0 -37
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js.map +0 -1
- package/src/commands/GenerateTypes/utils/playdateConstants.d.ts +0 -9
- package/src/commands/GenerateTypes/utils/playdateConstants.js +0 -134
- package/src/commands/GenerateTypes/utils/playdateConstants.js.map +0 -1
package/src/utils/dirname.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/cli/src/utils/dirname.ts"],"sourcesContent":["import { dirname
|
1
|
+
{"version":3,"sources":["../../../../../libs/cli/src/utils/dirname.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport const __dirname = dirname(fileURLToPath(import.meta.url));\n"],"names":["dirname","fileURLToPath","__dirname","url"],"rangeMappings":";;","mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,aAAa,QAAQ,WAAW;AAEzC,OAAO,MAAMC,YAAYF,QAAQC,cAAc,YAAYE,GAAG,GAAG"}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { _ as _extends } from "@swc/helpers/_/_extends";
|
2
|
-
import { load } from 'cheerio';
|
3
|
-
import { PlaydateSdkUrl } from '../../../commands/GenerateTypes/constants.js';
|
4
|
-
import { parseFunctionSignature } from '../../../commands/GenerateTypes/fn/parseFunctionSignature.js';
|
5
|
-
export const getFunctionDescriptionsFromHtml = (html, version)=>{
|
6
|
-
const $ = load(html);
|
7
|
-
const allSignatures = $('[id^="m-"], [id^="f-"], [id^="c-"]').toArray();
|
8
|
-
const result = [];
|
9
|
-
for (const element of allSignatures){
|
10
|
-
var _$_attr;
|
11
|
-
const id = (_$_attr = $(element).attr('id')) != null ? _$_attr : '';
|
12
|
-
var _$_find_text;
|
13
|
-
const titles = ((_$_find_text = $(element).find('.title').text()) != null ? _$_find_text : '').split(' ');
|
14
|
-
var _$_find_html;
|
15
|
-
let docsString = ((_$_find_html = $(element).find('.content').html()) != null ? _$_find_html : '').trim();
|
16
|
-
if (docsString.startsWith('<div class="paragraph">')) {
|
17
|
-
docsString = docsString.slice('<div class="paragraph">'.length);
|
18
|
-
}
|
19
|
-
if (docsString.endsWith('</div>')) {
|
20
|
-
docsString = docsString.slice(0, docsString.length - '</div>'.length);
|
21
|
-
}
|
22
|
-
docsString = docsString.replace(/<a href="#/g, '<a href="' + PlaydateSdkUrl + version + '#');
|
23
|
-
const docs = id ? `${docsString}\n[Read more](${PlaydateSdkUrl}${version}#${id})` : docsString;
|
24
|
-
for (const title of titles){
|
25
|
-
try {
|
26
|
-
result.push(_extends({}, parseFunctionSignature(title), {
|
27
|
-
docs
|
28
|
-
}));
|
29
|
-
} catch (e) {
|
30
|
-
// skip
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
return result;
|
35
|
-
};
|
36
|
-
|
37
|
-
//# sourceMappingURL=getFunctionDescriptionsFromHtml.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.ts"],"sourcesContent":["import { load } from 'cheerio';\nimport { PlaydateSdkUrl } from '@/cli/commands/GenerateTypes/constants.js';\nimport { parseFunctionSignature } from '@/cli/commands/GenerateTypes/fn/parseFunctionSignature.js';\nimport { FunctionDescription } from '@/cli/types.js';\n\nexport const getFunctionDescriptionsFromHtml = (\n html: string,\n version: string\n) => {\n const $ = load(html);\n\n const allSignatures = $('[id^=\"m-\"], [id^=\"f-\"], [id^=\"c-\"]').toArray();\n const result: FunctionDescription[] = [];\n\n for (const element of allSignatures) {\n const id = $(element).attr('id') ?? '';\n const titles = ($(element).find('.title').text() ?? '').split(' ');\n let docsString = ($(element).find('.content').html() ?? '').trim();\n\n if (docsString.startsWith('<div class=\"paragraph\">')) {\n docsString = docsString.slice('<div class=\"paragraph\">'.length);\n }\n\n if (docsString.endsWith('</div>')) {\n docsString = docsString.slice(\n 0,\n docsString.length - '</div>'.length\n );\n }\n\n docsString = docsString.replace(\n /<a href=\"#/g,\n '<a href=\"' + PlaydateSdkUrl + version + '#'\n );\n\n const docs = id\n ? `${docsString}\\n[Read more](${PlaydateSdkUrl}${version}#${id})`\n : docsString;\n\n for (const title of titles) {\n try {\n result.push({ ...parseFunctionSignature(title), docs });\n } catch (e) {\n // skip\n }\n }\n }\n\n return result;\n};\n"],"names":["load","PlaydateSdkUrl","parseFunctionSignature","getFunctionDescriptionsFromHtml","html","version","$","allSignatures","toArray","result","element","id","attr","titles","find","text","split","docsString","trim","startsWith","slice","length","endsWith","replace","docs","title","push","e"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SAASA,IAAI,QAAQ,UAAU;AAC/B,SAASC,cAAc,QAAQ,4CAA4C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|
4
|
-
values: [
|
5
|
-
{
|
6
|
-
name: 'Black',
|
7
|
-
value: 0,
|
8
|
-
docs: ''
|
9
|
-
},
|
10
|
-
{
|
11
|
-
name: 'White',
|
12
|
-
value: 1,
|
13
|
-
docs: ''
|
14
|
-
},
|
15
|
-
{
|
16
|
-
name: 'Clear',
|
17
|
-
value: 2,
|
18
|
-
docs: ''
|
19
|
-
},
|
20
|
-
{
|
21
|
-
name: 'XOR',
|
22
|
-
value: 4,
|
23
|
-
docs: ''
|
24
|
-
}
|
25
|
-
],
|
26
|
-
docs: ''
|
27
|
-
},
|
28
|
-
{
|
29
|
-
name: 'PlaydateImageFlip',
|
30
|
-
values: [
|
31
|
-
{
|
32
|
-
name: 'Unflipped',
|
33
|
-
value: 0,
|
34
|
-
docs: ''
|
35
|
-
},
|
36
|
-
{
|
37
|
-
name: 'FlippedX',
|
38
|
-
value: 1,
|
39
|
-
docs: ''
|
40
|
-
},
|
41
|
-
{
|
42
|
-
name: 'FlippedY',
|
43
|
-
value: 2,
|
44
|
-
docs: ''
|
45
|
-
},
|
46
|
-
{
|
47
|
-
name: 'FlippedXY',
|
48
|
-
value: 4,
|
49
|
-
docs: ''
|
50
|
-
}
|
51
|
-
],
|
52
|
-
docs: ''
|
53
|
-
},
|
54
|
-
{
|
55
|
-
name: 'PlaydatePolygonFill',
|
56
|
-
values: [
|
57
|
-
{
|
58
|
-
name: 'NonZero',
|
59
|
-
value: 1,
|
60
|
-
docs: ''
|
61
|
-
},
|
62
|
-
{
|
63
|
-
name: 'EvenOdd',
|
64
|
-
value: 2,
|
65
|
-
docs: ''
|
66
|
-
}
|
67
|
-
],
|
68
|
-
docs: ''
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: 'PlaydateButton',
|
72
|
-
values: [
|
73
|
-
{
|
74
|
-
name: 'Left',
|
75
|
-
value: 1,
|
76
|
-
docs: ''
|
77
|
-
},
|
78
|
-
{
|
79
|
-
name: 'Right',
|
80
|
-
value: 2,
|
81
|
-
docs: ''
|
82
|
-
},
|
83
|
-
{
|
84
|
-
name: 'Up',
|
85
|
-
value: 4,
|
86
|
-
docs: ''
|
87
|
-
},
|
88
|
-
{
|
89
|
-
name: 'Down',
|
90
|
-
value: 8,
|
91
|
-
docs: ''
|
92
|
-
},
|
93
|
-
{
|
94
|
-
name: 'B',
|
95
|
-
value: 16,
|
96
|
-
docs: ''
|
97
|
-
},
|
98
|
-
{
|
99
|
-
name: 'A',
|
100
|
-
value: 32,
|
101
|
-
docs: ''
|
102
|
-
},
|
103
|
-
{
|
104
|
-
name: 'Menu',
|
105
|
-
value: 64,
|
106
|
-
docs: ''
|
107
|
-
},
|
108
|
-
{
|
109
|
-
name: 'Lock',
|
110
|
-
value: 124,
|
111
|
-
docs: ''
|
112
|
-
}
|
113
|
-
],
|
114
|
-
docs: ''
|
115
|
-
},
|
116
|
-
{
|
117
|
-
name: 'PlaydateLanguage',
|
118
|
-
values: [
|
119
|
-
{
|
120
|
-
name: 'English',
|
121
|
-
value: 1,
|
122
|
-
docs: ''
|
123
|
-
},
|
124
|
-
{
|
125
|
-
name: 'Japanese',
|
126
|
-
value: 2,
|
127
|
-
docs: ''
|
128
|
-
}
|
129
|
-
],
|
130
|
-
docs: ''
|
131
|
-
}
|
132
|
-
];
|
133
|
-
|
134
|
-
//# sourceMappingURL=playdateConstants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/utils/playdateConstants.ts"],"sourcesContent":["import { ConstantDescription } from '@/cli/types.js';\n\nexport const playdateConstants = [\n {\n name: 'PlaydateColor',\n values: [\n { name: 'Black', value: 0, docs: '' },\n { name: 'White', value: 1, docs: '' },\n { name: 'Clear', value: 2, docs: '' },\n { name: 'XOR', value: 4, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateImageFlip',\n values: [\n { name: 'Unflipped', value: 0, docs: '' },\n { name: 'FlippedX', value: 1, docs: '' },\n { name: 'FlippedY', value: 2, docs: '' },\n { name: 'FlippedXY', value: 4, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydatePolygonFill',\n values: [\n { name: 'NonZero', value: 1, docs: '' },\n { name: 'EvenOdd', value: 2, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateButton',\n values: [\n { name: 'Left', value: 1, docs: '' },\n { name: 'Right', value: 2, docs: '' },\n { name: 'Up', value: 4, docs: '' },\n { name: 'Down', value: 8, docs: '' },\n { name: 'B', value: 16, docs: '' },\n { name: 'A', value: 32, docs: '' },\n { name: 'Menu', value: 64, docs: '' },\n { name: 'Lock', value: 124, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateLanguage',\n values: [\n { name: 'English', value: 1, docs: '' },\n { name: 'Japanese', value: 2, docs: '' },\n ],\n docs: '',\n },\n] satisfies ConstantDescription[];\n"],"names":["playdateConstants","name","values","value","docs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,oBAAoB;IAC7B;QACIC,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAAOE,OAAO;gBAAGC,MAAM;YAAG;SACrC;QACDA,MAAM;IACV;IACA;QACIH,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAAaE,OAAO;gBAAGC,MAAM;YAAG;YACxC;gBAAEH,MAAM;gBAAYE,OAAO;gBAAGC,MAAM;YAAG;YACvC;gBAAEH,MAAM;gBAAYE,OAAO;gBAAGC,MAAM;YAAG;YACvC;gBAAEH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