jtsx-loader 0.1.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/README.md +18 -0
- package/example/api/200.json +4 -0
- package/example/api/401.json +4 -0
- package/example/components/Inner.tsx +27 -0
- package/example/layouts/Layout.jsx +45 -0
- package/example/pages/en.jsx +139 -0
- package/example/pages/index.jsx +158 -0
- package/example/server.js +70 -0
- package/example/styles/default.css +231 -0
- package/example/styles/styles.css +1 -0
- package/factory/jsxFactory.js +137 -0
- package/factory/jsxUtils.js +18 -0
- package/factory/possibleAttributes.js +498 -0
- package/jtsx.config.example.js +17 -0
- package/jtsx.config.js +9 -0
- package/loader/loader.mjs +88 -0
- package/loader/register.mjs +2 -0
- package/nodemon.json +8 -0
- package/package.json +25 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
const possibleAttributes = {
|
|
2
|
+
// HTML
|
|
3
|
+
'accept': 'accept',
|
|
4
|
+
'acceptCharset': 'accept-charset',
|
|
5
|
+
'accessKey': 'accesskey',
|
|
6
|
+
'action': 'action',
|
|
7
|
+
'allowFullScreen': 'allowfullscreen',
|
|
8
|
+
'alt': 'alt',
|
|
9
|
+
'as': 'as',
|
|
10
|
+
'async': 'async',
|
|
11
|
+
'autoCapitalize': 'autocapitalize',
|
|
12
|
+
'autoComplete': 'autocomplete',
|
|
13
|
+
'autoCorrect': 'autocorrect',
|
|
14
|
+
'autoFocus': 'autofocus',
|
|
15
|
+
'autoPlay': 'autoplay',
|
|
16
|
+
'autoSave': 'autosave',
|
|
17
|
+
'capture': 'capture',
|
|
18
|
+
'cellPadding': 'cellpadding',
|
|
19
|
+
'cellSpacing': 'cellspacing',
|
|
20
|
+
'challenge': 'challenge',
|
|
21
|
+
'charSet': 'charset',
|
|
22
|
+
'checked': 'checked',
|
|
23
|
+
'children': 'children',
|
|
24
|
+
'cite': 'cite',
|
|
25
|
+
'className': 'class',
|
|
26
|
+
'classID': 'classid',
|
|
27
|
+
'className': 'classname',
|
|
28
|
+
'cols': 'cols',
|
|
29
|
+
'colSpan': 'colspan',
|
|
30
|
+
'content': 'content',
|
|
31
|
+
'contentEditable': 'contenteditable',
|
|
32
|
+
'contextMenu': 'contextmenu',
|
|
33
|
+
'controls': 'controls',
|
|
34
|
+
'controlsList': 'controlslist',
|
|
35
|
+
'coords': 'coords',
|
|
36
|
+
'crossOrigin': 'crossorigin',
|
|
37
|
+
'dangerouslySetInnerHTML': 'dangerouslysetinnerhtml',
|
|
38
|
+
'data': 'data',
|
|
39
|
+
'dateTime': 'datetime',
|
|
40
|
+
'default': 'default',
|
|
41
|
+
'defaultChecked': 'defaultchecked',
|
|
42
|
+
'defaultValue': 'defaultvalue',
|
|
43
|
+
'defer': 'defer',
|
|
44
|
+
'dir': 'dir',
|
|
45
|
+
'disabled': 'disabled',
|
|
46
|
+
'disablePictureInPicture': 'disablepictureinpicture',
|
|
47
|
+
'disableRemotePlayback': 'disableremoteplayback',
|
|
48
|
+
'download': 'download',
|
|
49
|
+
'draggable': 'draggable',
|
|
50
|
+
'encType': 'enctype',
|
|
51
|
+
'enterKeyHint': 'enterkeyhint',
|
|
52
|
+
'fetchPriority': 'fetchpriority',
|
|
53
|
+
'htmlFor': 'for',
|
|
54
|
+
'form': 'form',
|
|
55
|
+
'formMethod': 'formmethod',
|
|
56
|
+
'formAction': 'formaction',
|
|
57
|
+
'formEncType': 'formenctype',
|
|
58
|
+
'formNoValidate': 'formnovalidate',
|
|
59
|
+
'formTarget': 'formtarget',
|
|
60
|
+
'frameBorder': 'frameborder',
|
|
61
|
+
'headers': 'headers',
|
|
62
|
+
'height': 'height',
|
|
63
|
+
'hidden': 'hidden',
|
|
64
|
+
'high': 'high',
|
|
65
|
+
'href': 'href',
|
|
66
|
+
'hrefLang': 'hreflang',
|
|
67
|
+
'htmlFor': 'htmlfor',
|
|
68
|
+
'httpEquiv': 'httpequiv',
|
|
69
|
+
'httpEquiv': 'http-equiv',
|
|
70
|
+
'icon': 'icon',
|
|
71
|
+
'id': 'id',
|
|
72
|
+
'imageSizes': 'imagesizes',
|
|
73
|
+
'imageSrcSet': 'imagesrcset',
|
|
74
|
+
'inert': 'inert',
|
|
75
|
+
'innerHTML': 'innerhtml',
|
|
76
|
+
'inputMode': 'inputmode',
|
|
77
|
+
'integrity': 'integrity',
|
|
78
|
+
'is': 'is',
|
|
79
|
+
'itemID': 'itemid',
|
|
80
|
+
'itemProp': 'itemprop',
|
|
81
|
+
'itemRef': 'itemref',
|
|
82
|
+
'itemScope': 'itemscope',
|
|
83
|
+
'itemType': 'itemtype',
|
|
84
|
+
'keyParams': 'keyparams',
|
|
85
|
+
'keyType': 'keytype',
|
|
86
|
+
'kind': 'kind',
|
|
87
|
+
'label': 'label',
|
|
88
|
+
'lang': 'lang',
|
|
89
|
+
'list': 'list',
|
|
90
|
+
'loop': 'loop',
|
|
91
|
+
'low': 'low',
|
|
92
|
+
'manifest': 'manifest',
|
|
93
|
+
'marginWidth': 'marginwidth',
|
|
94
|
+
'marginHeight': 'marginheight',
|
|
95
|
+
'max': 'max',
|
|
96
|
+
'maxLength': 'maxlength',
|
|
97
|
+
'media': 'media',
|
|
98
|
+
'mediaGroup': 'mediagroup',
|
|
99
|
+
'method': 'method',
|
|
100
|
+
'min': 'min',
|
|
101
|
+
'minLength': 'minlength',
|
|
102
|
+
'multiple': 'multiple',
|
|
103
|
+
'muted': 'muted',
|
|
104
|
+
'name': 'name',
|
|
105
|
+
'noModule': 'nomodule',
|
|
106
|
+
'nonce': 'nonce',
|
|
107
|
+
'noValidate': 'novalidate',
|
|
108
|
+
'open': 'open',
|
|
109
|
+
'optimum': 'optimum',
|
|
110
|
+
'pattern': 'pattern',
|
|
111
|
+
'placeholder': 'placeholder',
|
|
112
|
+
'playsInline': 'playsinline',
|
|
113
|
+
'poster': 'poster',
|
|
114
|
+
'preload': 'preload',
|
|
115
|
+
'profile': 'profile',
|
|
116
|
+
'radioGroup': 'radiogroup',
|
|
117
|
+
'readOnly': 'readonly',
|
|
118
|
+
'referrerPolicy': 'referrerpolicy',
|
|
119
|
+
'rel': 'rel',
|
|
120
|
+
'required': 'required',
|
|
121
|
+
'reversed': 'reversed',
|
|
122
|
+
'role': 'role',
|
|
123
|
+
'rows': 'rows',
|
|
124
|
+
'rowSpan': 'rowspan',
|
|
125
|
+
'sandbox': 'sandbox',
|
|
126
|
+
'scope': 'scope',
|
|
127
|
+
'scoped': 'scoped',
|
|
128
|
+
'scrolling': 'scrolling',
|
|
129
|
+
'seamless': 'seamless',
|
|
130
|
+
'selected': 'selected',
|
|
131
|
+
'shape': 'shape',
|
|
132
|
+
'size': 'size',
|
|
133
|
+
'sizes': 'sizes',
|
|
134
|
+
'span': 'span',
|
|
135
|
+
'spellCheck': 'spellcheck',
|
|
136
|
+
'src': 'src',
|
|
137
|
+
'srcDoc': 'srcdoc',
|
|
138
|
+
'srcLang': 'srclang',
|
|
139
|
+
'srcSet': 'srcset',
|
|
140
|
+
'start': 'start',
|
|
141
|
+
'step': 'step',
|
|
142
|
+
'style': 'style',
|
|
143
|
+
'summary': 'summary',
|
|
144
|
+
'tabIndex': 'tabindex',
|
|
145
|
+
'target': 'target',
|
|
146
|
+
'title': 'title',
|
|
147
|
+
'type': 'type',
|
|
148
|
+
'useMap': 'usemap',
|
|
149
|
+
'value': 'value',
|
|
150
|
+
'width': 'width',
|
|
151
|
+
'wmode': 'wmode',
|
|
152
|
+
'wrap': 'wrap',
|
|
153
|
+
|
|
154
|
+
// SVG
|
|
155
|
+
'about': 'about',
|
|
156
|
+
'accentHeight': 'accentheight',
|
|
157
|
+
'accentHeight': 'accent-height',
|
|
158
|
+
'accumulate': 'accumulate',
|
|
159
|
+
'additive': 'additive',
|
|
160
|
+
'alignmentBaseline': 'alignmentbaseline',
|
|
161
|
+
'alignmentBaseline': 'alignment-baseline',
|
|
162
|
+
'allowReorder': 'allowreorder',
|
|
163
|
+
'alphabetic': 'alphabetic',
|
|
164
|
+
'amplitude': 'amplitude',
|
|
165
|
+
'arabicForm': 'arabicform',
|
|
166
|
+
'arabicForm': 'arabic-form',
|
|
167
|
+
'ascent': 'ascent',
|
|
168
|
+
'attributeName': 'attributename',
|
|
169
|
+
'attributeType': 'attributetype',
|
|
170
|
+
'autoReverse': 'autoreverse',
|
|
171
|
+
'azimuth': 'azimuth',
|
|
172
|
+
'baseFrequency': 'basefrequency',
|
|
173
|
+
'baselineShift': 'baselineshift',
|
|
174
|
+
'baselineShift': 'baseline-shift',
|
|
175
|
+
'baseProfile': 'baseprofile',
|
|
176
|
+
'bbox': 'bbox',
|
|
177
|
+
'begin': 'begin',
|
|
178
|
+
'bias': 'bias',
|
|
179
|
+
'by': 'by',
|
|
180
|
+
'calcMode': 'calcmode',
|
|
181
|
+
'capHeight': 'capheight',
|
|
182
|
+
'capHeight': 'cap-height',
|
|
183
|
+
'clip': 'clip',
|
|
184
|
+
'clipPath': 'clippath',
|
|
185
|
+
'clipPath': 'clip-path',
|
|
186
|
+
'clipPathUnits': 'clippathunits',
|
|
187
|
+
'clipRule': 'cliprule',
|
|
188
|
+
'clipRule': 'clip-rule',
|
|
189
|
+
'color': 'color',
|
|
190
|
+
'colorInterpolation': 'colorinterpolation',
|
|
191
|
+
'colorInterpolation': 'color-interpolation',
|
|
192
|
+
'colorInterpolationFilters': 'colorinterpolationfilters',
|
|
193
|
+
'colorInterpolationFilters': 'color-interpolation-filters',
|
|
194
|
+
'colorProfile': 'colorprofile',
|
|
195
|
+
'colorProfile': 'color-profile',
|
|
196
|
+
'colorRendering': 'colorrendering',
|
|
197
|
+
'colorRendering': 'color-rendering',
|
|
198
|
+
'contentScriptType': 'contentscripttype',
|
|
199
|
+
'contentStyleType': 'contentstyletype',
|
|
200
|
+
'cursor': 'cursor',
|
|
201
|
+
'cx': 'cx',
|
|
202
|
+
'cy': 'cy',
|
|
203
|
+
'd': 'd',
|
|
204
|
+
'datatype': 'datatype',
|
|
205
|
+
'decelerate': 'decelerate',
|
|
206
|
+
'descent': 'descent',
|
|
207
|
+
'diffuseConstant': 'diffuseconstant',
|
|
208
|
+
'direction': 'direction',
|
|
209
|
+
'display': 'display',
|
|
210
|
+
'divisor': 'divisor',
|
|
211
|
+
'dominantBaseline': 'dominantbaseline',
|
|
212
|
+
'dominantBaseline': 'dominant-baseline',
|
|
213
|
+
'dur': 'dur',
|
|
214
|
+
'dx': 'dx',
|
|
215
|
+
'dy': 'dy',
|
|
216
|
+
'edgeMode': 'edgemode',
|
|
217
|
+
'elevation': 'elevation',
|
|
218
|
+
'enableBackground': 'enablebackground',
|
|
219
|
+
'enableBackground': 'enable-background',
|
|
220
|
+
'end': 'end',
|
|
221
|
+
'exponent': 'exponent',
|
|
222
|
+
'externalResourcesRequired': 'externalresourcesrequired',
|
|
223
|
+
'fill': 'fill',
|
|
224
|
+
'fillOpacity': 'fillopacity',
|
|
225
|
+
'fillOpacity': 'fill-opacity',
|
|
226
|
+
'fillRule': 'fillrule',
|
|
227
|
+
'fillRule': 'fill-rule',
|
|
228
|
+
'filter': 'filter',
|
|
229
|
+
'filterRes': 'filterres',
|
|
230
|
+
'filterUnits': 'filterunits',
|
|
231
|
+
'floodOpacity': 'floodopacity',
|
|
232
|
+
'floodOpacity': 'flood-opacity',
|
|
233
|
+
'floodColor': 'floodcolor',
|
|
234
|
+
'floodColor': 'flood-color',
|
|
235
|
+
'focusable': 'focusable',
|
|
236
|
+
'fontFamily': 'fontfamily',
|
|
237
|
+
'fontFamily': 'font-family',
|
|
238
|
+
'fontSize': 'fontsize',
|
|
239
|
+
'fontSize': 'font-size',
|
|
240
|
+
'fontSizeAdjust': 'fontsizeadjust',
|
|
241
|
+
'fontSizeAdjust': 'font-size-adjust',
|
|
242
|
+
'fontStretch': 'fontstretch',
|
|
243
|
+
'fontStretch': 'font-stretch',
|
|
244
|
+
'fontStyle': 'fontstyle',
|
|
245
|
+
'fontStyle': 'font-style',
|
|
246
|
+
'fontVariant': 'fontvariant',
|
|
247
|
+
'fontVariant': 'font-variant',
|
|
248
|
+
'fontWeight': 'fontweight',
|
|
249
|
+
'fontWeight': 'font-weight',
|
|
250
|
+
'format': 'format',
|
|
251
|
+
'from': 'from',
|
|
252
|
+
'fx': 'fx',
|
|
253
|
+
'fy': 'fy',
|
|
254
|
+
'g1': 'g1',
|
|
255
|
+
'g2': 'g2',
|
|
256
|
+
'glyphName': 'glyphname',
|
|
257
|
+
'glyphName': 'glyph-name',
|
|
258
|
+
'glyphOrientationHorizontal': 'glyphorientationhorizontal',
|
|
259
|
+
'glyphOrientationHorizontal': 'glyph-orientation-horizontal',
|
|
260
|
+
'glyphOrientationVertical': 'glyphorientationvertical',
|
|
261
|
+
'glyphOrientationVertical': 'glyph-orientation-vertical',
|
|
262
|
+
'glyphRef': 'glyphref',
|
|
263
|
+
'gradientTransform': 'gradienttransform',
|
|
264
|
+
'gradientUnits': 'gradientunits',
|
|
265
|
+
'hanging': 'hanging',
|
|
266
|
+
'horizAdvX': 'horizadvx',
|
|
267
|
+
'horizAdvX': 'horiz-adv-x',
|
|
268
|
+
'horizOriginX': 'horizoriginx',
|
|
269
|
+
'horizOriginX': 'horiz-origin-x',
|
|
270
|
+
'ideographic': 'ideographic',
|
|
271
|
+
'imageRendering': 'imagerendering',
|
|
272
|
+
'imageRendering': 'image-rendering',
|
|
273
|
+
'in2': 'in2',
|
|
274
|
+
'in': 'in',
|
|
275
|
+
'inlist': 'inlist',
|
|
276
|
+
'intercept': 'intercept',
|
|
277
|
+
'k1': 'k1',
|
|
278
|
+
'k2': 'k2',
|
|
279
|
+
'k3': 'k3',
|
|
280
|
+
'k4': 'k4',
|
|
281
|
+
'k': 'k',
|
|
282
|
+
'kernelMatrix': 'kernelmatrix',
|
|
283
|
+
'kernelUnitLength': 'kernelunitlength',
|
|
284
|
+
'kerning': 'kerning',
|
|
285
|
+
'keyPoints': 'keypoints',
|
|
286
|
+
'keySplines': 'keysplines',
|
|
287
|
+
'keyTimes': 'keytimes',
|
|
288
|
+
'lengthAdjust': 'lengthadjust',
|
|
289
|
+
'letterSpacing': 'letterspacing',
|
|
290
|
+
'letterSpacing': 'letter-spacing',
|
|
291
|
+
'lightingColor': 'lightingcolor',
|
|
292
|
+
'lightingColor': 'lighting-color',
|
|
293
|
+
'limitingConeAngle': 'limitingconeangle',
|
|
294
|
+
'local': 'local',
|
|
295
|
+
'markerEnd': 'markerend',
|
|
296
|
+
'markerEnd': 'marker-end',
|
|
297
|
+
'markerHeight': 'markerheight',
|
|
298
|
+
'markerMid': 'markermid',
|
|
299
|
+
'markerMid': 'marker-mid',
|
|
300
|
+
'markerStart': 'markerstart',
|
|
301
|
+
'markerStart': 'marker-start',
|
|
302
|
+
'markerUnits': 'markerunits',
|
|
303
|
+
'markerWidth': 'markerwidth',
|
|
304
|
+
'mask': 'mask',
|
|
305
|
+
'maskContentUnits': 'maskcontentunits',
|
|
306
|
+
'maskUnits': 'maskunits',
|
|
307
|
+
'mathematical': 'mathematical',
|
|
308
|
+
'mode': 'mode',
|
|
309
|
+
'numOctaves': 'numoctaves',
|
|
310
|
+
'offset': 'offset',
|
|
311
|
+
'opacity': 'opacity',
|
|
312
|
+
'operator': 'operator',
|
|
313
|
+
'order': 'order',
|
|
314
|
+
'orient': 'orient',
|
|
315
|
+
'orientation': 'orientation',
|
|
316
|
+
'origin': 'origin',
|
|
317
|
+
'overflow': 'overflow',
|
|
318
|
+
'overlinePosition': 'overlineposition',
|
|
319
|
+
'overlinePosition': 'overline-position',
|
|
320
|
+
'overlineThickness': 'overlinethickness',
|
|
321
|
+
'overlineThickness': 'overline-thickness',
|
|
322
|
+
'paintOrder': 'paintorder',
|
|
323
|
+
'paintOrder': 'paint-order',
|
|
324
|
+
'panose1': 'panose1',
|
|
325
|
+
'panose1': 'panose-1',
|
|
326
|
+
'pathLength': 'pathlength',
|
|
327
|
+
'patternContentUnits': 'patterncontentunits',
|
|
328
|
+
'patternTransform': 'patterntransform',
|
|
329
|
+
'patternUnits': 'patternunits',
|
|
330
|
+
'pointerEvents': 'pointerevents',
|
|
331
|
+
'pointerEvents': 'pointer-events',
|
|
332
|
+
'points': 'points',
|
|
333
|
+
'pointsAtX': 'pointsatx',
|
|
334
|
+
'pointsAtY': 'pointsaty',
|
|
335
|
+
'pointsAtZ': 'pointsatz',
|
|
336
|
+
'popover': 'popover',
|
|
337
|
+
'popoverTarget': 'popovertarget',
|
|
338
|
+
'popoverTargetAction': 'popovertargetaction',
|
|
339
|
+
'prefix': 'prefix',
|
|
340
|
+
'preserveAlpha': 'preservealpha',
|
|
341
|
+
'preserveAspectRatio': 'preserveAspectRatio',
|
|
342
|
+
'primitiveUnits': 'primitiveunits',
|
|
343
|
+
'property': 'property',
|
|
344
|
+
'r': 'r',
|
|
345
|
+
'radius': 'radius',
|
|
346
|
+
'refX': 'refx',
|
|
347
|
+
'refY': 'refy',
|
|
348
|
+
'renderingIntent': 'renderingintent',
|
|
349
|
+
'renderingIntent': 'rendering-intent',
|
|
350
|
+
'repeatCount': 'repeatcount',
|
|
351
|
+
'repeatDur': 'repeatdur',
|
|
352
|
+
'requiredExtensions': 'requiredextensions',
|
|
353
|
+
'requiredFeatures': 'requiredfeatures',
|
|
354
|
+
'resource': 'resource',
|
|
355
|
+
'restart': 'restart',
|
|
356
|
+
'result': 'result',
|
|
357
|
+
'results': 'results',
|
|
358
|
+
'rotate': 'rotate',
|
|
359
|
+
'rx': 'rx',
|
|
360
|
+
'ry': 'ry',
|
|
361
|
+
'scale': 'scale',
|
|
362
|
+
'security': 'security',
|
|
363
|
+
'seed': 'seed',
|
|
364
|
+
'shapeRendering': 'shaperendering',
|
|
365
|
+
'shapeRendering': 'shape-rendering',
|
|
366
|
+
'slope': 'slope',
|
|
367
|
+
'spacing': 'spacing',
|
|
368
|
+
'specularConstant': 'specularconstant',
|
|
369
|
+
'specularExponent': 'specularexponent',
|
|
370
|
+
'speed': 'speed',
|
|
371
|
+
'spreadMethod': 'spreadmethod',
|
|
372
|
+
'startOffset': 'startoffset',
|
|
373
|
+
'stdDeviation': 'stddeviation',
|
|
374
|
+
'stemh': 'stemh',
|
|
375
|
+
'stemv': 'stemv',
|
|
376
|
+
'stitchTiles': 'stitchtiles',
|
|
377
|
+
'stopColor': 'stopcolor',
|
|
378
|
+
'stopColor': 'stop-color',
|
|
379
|
+
'stopOpacity': 'stopopacity',
|
|
380
|
+
'stopOpacity': 'stop-opacity',
|
|
381
|
+
'strikethroughPosition': 'strikethroughposition',
|
|
382
|
+
'strikethroughPosition': 'strikethrough-position',
|
|
383
|
+
'strikethroughThickness': 'strikethroughthickness',
|
|
384
|
+
'strikethroughThickness': 'strikethrough-thickness',
|
|
385
|
+
'string': 'string',
|
|
386
|
+
'stroke': 'stroke',
|
|
387
|
+
'strokeDasharray': 'strokedasharray',
|
|
388
|
+
'strokeDasharray': 'stroke-dasharray',
|
|
389
|
+
'strokeDashoffset': 'strokedashoffset',
|
|
390
|
+
'strokeDashoffset': 'stroke-dashoffset',
|
|
391
|
+
'strokeLinecap': 'strokelinecap',
|
|
392
|
+
'strokeLinecap': 'stroke-linecap',
|
|
393
|
+
'strokeLinejoin': 'strokelinejoin',
|
|
394
|
+
'strokeLinejoin': 'stroke-linejoin',
|
|
395
|
+
'strokeMiterlimit': 'strokemiterlimit',
|
|
396
|
+
'strokeMiterlimit': 'stroke-miterlimit',
|
|
397
|
+
'strokeWidth': 'strokewidth',
|
|
398
|
+
'strokeWidth': 'stroke-width',
|
|
399
|
+
'strokeOpacity': 'strokeopacity',
|
|
400
|
+
'strokeOpacity': 'stroke-opacity',
|
|
401
|
+
'suppressContentEditableWarning': 'suppresscontenteditablewarning',
|
|
402
|
+
'suppressHydrationWarning': 'suppresshydrationwarning',
|
|
403
|
+
'surfaceScale': 'surfacescale',
|
|
404
|
+
'systemLanguage': 'systemlanguage',
|
|
405
|
+
'tableValues': 'tablevalues',
|
|
406
|
+
'targetX': 'targetx',
|
|
407
|
+
'targetY': 'targety',
|
|
408
|
+
'textAnchor': 'textanchor',
|
|
409
|
+
'textAnchor': 'text-anchor',
|
|
410
|
+
'textDecoration': 'textdecoration',
|
|
411
|
+
'textDecoration': 'text-decoration',
|
|
412
|
+
'textLength': 'textlength',
|
|
413
|
+
'textRendering': 'textrendering',
|
|
414
|
+
'textRendering': 'text-rendering',
|
|
415
|
+
'to': 'to',
|
|
416
|
+
'transform': 'transform',
|
|
417
|
+
'transformOrigin': 'transformorigin',
|
|
418
|
+
'transformOrigin': 'transform-origin',
|
|
419
|
+
'typeof': 'typeof',
|
|
420
|
+
'u1': 'u1',
|
|
421
|
+
'u2': 'u2',
|
|
422
|
+
'underlinePosition': 'underlineposition',
|
|
423
|
+
'underlinePosition': 'underline-position',
|
|
424
|
+
'underlineThickness': 'underlinethickness',
|
|
425
|
+
'underlineThickness': 'underline-thickness',
|
|
426
|
+
'unicode': 'unicode',
|
|
427
|
+
'unicodeBidi': 'unicodebidi',
|
|
428
|
+
'unicodeBidi': 'unicode-bidi',
|
|
429
|
+
'unicodeRange': 'unicoderange',
|
|
430
|
+
'unicodeRange': 'unicode-range',
|
|
431
|
+
'unitsPerEm': 'unitsperem',
|
|
432
|
+
'unitsPerEm': 'units-per-em',
|
|
433
|
+
'unselectable': 'unselectable',
|
|
434
|
+
'vAlphabetic': 'valphabetic',
|
|
435
|
+
'vAlphabetic': 'v-alphabetic',
|
|
436
|
+
'values': 'values',
|
|
437
|
+
'vectorEffect': 'vectoreffect',
|
|
438
|
+
'vectorEffect': 'vector-effect',
|
|
439
|
+
'version': 'version',
|
|
440
|
+
'vertAdvY': 'vertadvy',
|
|
441
|
+
'vertAdvY': 'vert-adv-y',
|
|
442
|
+
'vertOriginX': 'vertoriginx',
|
|
443
|
+
'vertOriginX': 'vert-origin-x',
|
|
444
|
+
'vertOriginY': 'vertoriginy',
|
|
445
|
+
'vertOriginY': 'vert-origin-y',
|
|
446
|
+
'vHanging': 'vhanging',
|
|
447
|
+
'vHanging': 'v-hanging',
|
|
448
|
+
'vIdeographic': 'videographic',
|
|
449
|
+
'vIdeographic': 'v-ideographic',
|
|
450
|
+
'viewBox': 'viewBox',
|
|
451
|
+
'viewTarget': 'viewtarget',
|
|
452
|
+
'visibility': 'visibility',
|
|
453
|
+
'vMathematical': 'vmathematical',
|
|
454
|
+
'vMathematical': 'v-mathematical',
|
|
455
|
+
'vocab': 'vocab',
|
|
456
|
+
'widths': 'widths',
|
|
457
|
+
'wordSpacing': 'wordspacing',
|
|
458
|
+
'wordSpacing': 'word-spacing',
|
|
459
|
+
'writingMode': 'writingmode',
|
|
460
|
+
'writingMode': 'writing-mode',
|
|
461
|
+
'x1': 'x1',
|
|
462
|
+
'x2': 'x2',
|
|
463
|
+
'x': 'x',
|
|
464
|
+
'xChannelSelector': 'xchannelselector',
|
|
465
|
+
'xHeight': 'xheight',
|
|
466
|
+
'xHeight': 'x-height',
|
|
467
|
+
'xlinkActuate': 'xlinkactuate',
|
|
468
|
+
'xlinkActuate': 'xlink:actuate',
|
|
469
|
+
'xlinkArcrole': 'xlinkarcrole',
|
|
470
|
+
'xlinkArcrole': 'xlink:arcrole',
|
|
471
|
+
'xlinkHref': 'xlinkhref',
|
|
472
|
+
'xlinkHref': 'xlink:href',
|
|
473
|
+
'xlinkRole': 'xlinkrole',
|
|
474
|
+
'xlinkRole': 'xlink:role',
|
|
475
|
+
'xlinkShow': 'xlinkshow',
|
|
476
|
+
'xlinkShow': 'xlink:show',
|
|
477
|
+
'xlinkTitle': 'xlinktitle',
|
|
478
|
+
'xlinkTitle': 'xlink:title',
|
|
479
|
+
'xlinkType': 'xlinktype',
|
|
480
|
+
'xlinkType': 'xlink:type',
|
|
481
|
+
'xmlBase': 'xmlbase',
|
|
482
|
+
'xmlBase': 'xml:base',
|
|
483
|
+
'xmlLang': 'xmllang',
|
|
484
|
+
'xmlLang': 'xml:lang',
|
|
485
|
+
'xmlns': 'xmlns',
|
|
486
|
+
'xmlSpace': 'xml:space',
|
|
487
|
+
'xmlnsXlink': 'xmlnsxlink',
|
|
488
|
+
'xmlnsXlink': 'xmlns:xlink',
|
|
489
|
+
'xmlSpace': 'xmlspace',
|
|
490
|
+
'y1': 'y1',
|
|
491
|
+
'y2': 'y2',
|
|
492
|
+
'y': 'y',
|
|
493
|
+
'yChannelSelector': 'ychannelselector',
|
|
494
|
+
'z': 'z',
|
|
495
|
+
'zoomAndPan': 'zoomandpan',
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export default possibleAttributes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// Esbuild transform config https://esbuild.github.io/api/#transform
|
|
3
|
+
esbuildTransformConfig: undefined,
|
|
4
|
+
|
|
5
|
+
// custom factory path, #@ is native node.js alias from package.json
|
|
6
|
+
importFactory: `import { _jsx, _jsxFragment, _jsxUtils } from 'jtsx-loader/factory/jsxFactory.js';`,
|
|
7
|
+
|
|
8
|
+
// Custom attribute parser. Attribute with colon determined as custom and called method by first part before colon
|
|
9
|
+
// Example method below will be called for attribute "ac:anything" in jsx and returns data-ac-anything="value"
|
|
10
|
+
attributeParser: {
|
|
11
|
+
ac: (attribute, value) => {
|
|
12
|
+
const attr = attribute.replace(/:/gi, '-');
|
|
13
|
+
console.log('attr', attr);
|
|
14
|
+
return `data-${attr}="${value}"`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/jtsx.config.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { transformSync } from 'esbuild';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { register, isBuiltin } from 'node:module';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
|
|
7
|
+
// TODO: убрать esm-reload
|
|
8
|
+
// INSPIRED: https://github.com/pygy/esm-reload/tree/main
|
|
9
|
+
let id = 0;
|
|
10
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
11
|
+
const result = await nextResolve(specifier, context);
|
|
12
|
+
|
|
13
|
+
if (!isBuiltin(result.url) && context.parentURL) {
|
|
14
|
+
const url = new URL(result.url);
|
|
15
|
+
const parentUrl = new URL(context.parentURL);
|
|
16
|
+
// TODO: заменить на v=1
|
|
17
|
+
const instance = url.searchParams.get("reload") === ""
|
|
18
|
+
? `esm-reload-${id++}`
|
|
19
|
+
: parentUrl.searchParams.get("instance");
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if (instance !== null) {
|
|
23
|
+
if (url.searchParams.has('reload')) {
|
|
24
|
+
url.searchParams.delete('reload')
|
|
25
|
+
}
|
|
26
|
+
url.searchParams.set("instance", instance);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
...result,
|
|
30
|
+
url: `${url}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* INFO:
|
|
38
|
+
import.meta.dirname всегда указывает на расположение текущего файла
|
|
39
|
+
cwd полностью зависит от контекста вызова
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const configUrl = pathToFileURL(path.join(process.cwd(), 'jtsx.config.js'));
|
|
43
|
+
let loadedConfig = (await import(configUrl.href).catch(() => ({}))).default;
|
|
44
|
+
|
|
45
|
+
let config = {
|
|
46
|
+
esbuildTransformConfig: null,
|
|
47
|
+
importFactory: `import { _jsx, _jsxFragment, _jsxUtils } from 'jtsx-loader/factory/jsxFactory.js';`,
|
|
48
|
+
...loadedConfig
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// TODO: typescript supported, add types for native HTML
|
|
52
|
+
export async function load(url, context, nextLoad) {
|
|
53
|
+
const urlSanitized = url.split('?')[0];
|
|
54
|
+
|
|
55
|
+
if (urlSanitized.endsWith('.jsx') || urlSanitized.endsWith('.tsx')) {
|
|
56
|
+
const ext = (urlSanitized.endsWith('.jsx') && 'jsx') || (urlSanitized.endsWith('.tsx') && 'tsx');
|
|
57
|
+
const filePath = fileURLToPath(url);
|
|
58
|
+
|
|
59
|
+
let source = (await readFile(filePath, 'utf-8')).toString();
|
|
60
|
+
|
|
61
|
+
if (!config?.esbuildTransformConfig) {
|
|
62
|
+
source = config.importFactory + '\n' + source;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const esbuildTransformConfig = {
|
|
66
|
+
jsxFactory: '_jsx',
|
|
67
|
+
jsxFragment: '_jsxFragment',
|
|
68
|
+
loader: ext,
|
|
69
|
+
format: 'esm',
|
|
70
|
+
...config.esbuildTransformConfig
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let transformed;
|
|
74
|
+
try {
|
|
75
|
+
transformed = transformSync(source, esbuildTransformConfig);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
throw new Error(error.message);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
format: 'module',
|
|
82
|
+
source: transformed.code,
|
|
83
|
+
shortCircuit: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return nextLoad(url, context);
|
|
88
|
+
}
|
package/nodemon.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jtsx-loader",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./loader/register.mjs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"imports": {
|
|
7
|
+
"#@/*": "./*"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node --import ./loader/register.mjs ./example/server.js",
|
|
11
|
+
"dev": "nodemon --import ./loader/register.mjs ./example/server.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "Dergachev Mihail <dergachev.mihail@gmail.com>",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"description": "JSX and TSX loader that allows you to compile to static HTML",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"esbuild": "^0.23.1"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"htmlfy": "^0.2.1",
|
|
22
|
+
"express": "^4.19.2",
|
|
23
|
+
"nodemon": "^3.1.4"
|
|
24
|
+
}
|
|
25
|
+
}
|