@knighted/jsx 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cjs/cli/init.cjs +15 -0
- package/dist/cjs/debug/diagnostics.cjs +57 -0
- package/dist/cjs/debug/diagnostics.d.cts +6 -0
- package/dist/cjs/debug/index.cjs +7 -0
- package/dist/cjs/debug/index.d.cts +2 -0
- package/dist/cjs/internal/attribute-resolution.cjs +22 -4
- package/dist/cjs/internal/attribute-resolution.d.cts +5 -0
- package/dist/cjs/internal/dev-environment.cjs +41 -0
- package/dist/cjs/internal/dev-environment.d.cts +4 -0
- package/dist/cjs/internal/event-bindings.cjs +11 -2
- package/dist/cjs/internal/event-bindings.d.cts +5 -1
- package/dist/cjs/internal/template-diagnostics.cjs +171 -0
- package/dist/cjs/internal/template-diagnostics.d.cts +13 -0
- package/dist/cjs/jsx.cjs +2 -2
- package/dist/cjs/loader/jsx.cjs +72 -20
- package/dist/cjs/loader/jsx.d.cts +6 -1
- package/dist/cjs/node/debug/index.cjs +6 -0
- package/dist/cjs/node/debug/index.d.cts +2 -0
- package/dist/cjs/react/react-jsx.cjs +1 -1
- package/dist/cjs/runtime/shared.cjs +41 -22
- package/dist/cjs/runtime/shared.d.cts +5 -2
- package/dist/cli/init.js +17 -0
- package/dist/debug/diagnostics.d.ts +6 -0
- package/dist/debug/diagnostics.js +52 -0
- package/dist/debug/index.d.ts +2 -0
- package/dist/debug/index.js +3 -0
- package/dist/internal/attribute-resolution.d.ts +5 -0
- package/dist/internal/attribute-resolution.js +20 -3
- package/dist/internal/dev-environment.d.ts +4 -0
- package/dist/internal/dev-environment.js +34 -0
- package/dist/internal/event-bindings.d.ts +5 -1
- package/dist/internal/event-bindings.js +9 -1
- package/dist/internal/template-diagnostics.d.ts +13 -0
- package/dist/internal/template-diagnostics.js +167 -0
- package/dist/jsx.js +3 -3
- package/dist/lite/debug/diagnostics.js +1 -0
- package/dist/lite/debug/index.js +8 -0
- package/dist/lite/index.js +8 -4
- package/dist/lite/node/debug/index.js +8 -0
- package/dist/lite/node/index.js +8 -4
- package/dist/lite/node/react/index.js +7 -3
- package/dist/lite/react/index.js +7 -3
- package/dist/loader/jsx.d.ts +6 -1
- package/dist/loader/jsx.js +72 -20
- package/dist/node/debug/index.d.ts +2 -0
- package/dist/node/debug/index.js +6 -0
- package/dist/react/react-jsx.js +2 -2
- package/dist/runtime/shared.d.ts +5 -2
- package/dist/runtime/shared.js +39 -21
- package/package.json +39 -7
package/dist/loader/jsx.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import MagicString from 'magic-string';
|
|
2
2
|
import { parseSync } from 'oxc-parser';
|
|
3
|
+
import { formatTaggedTemplateParserError, } from '../internal/template-diagnostics.js';
|
|
3
4
|
const createPlaceholderMap = (placeholders) => new Map(placeholders.map(entry => [entry.marker, entry.code]));
|
|
4
5
|
class ReactTemplateBuilder {
|
|
5
6
|
placeholderMap;
|
|
@@ -377,10 +378,12 @@ const renderTemplateWithSlots = (source, slots) => {
|
|
|
377
378
|
output += escapeTemplateChunk(source.slice(cursor));
|
|
378
379
|
return { code: output, changed: slots.length > 0 };
|
|
379
380
|
};
|
|
380
|
-
const transformTemplateLiteral = (templateSource, resourcePath) => {
|
|
381
|
+
const transformTemplateLiteral = (templateSource, resourcePath, tagName, templates, diagnostics) => {
|
|
381
382
|
const result = parseSync(`${resourcePath}?jsx-template`, templateSource, TEMPLATE_PARSER_OPTIONS);
|
|
382
383
|
if (result.errors.length > 0) {
|
|
383
|
-
throw new Error(
|
|
384
|
+
throw new Error(formatTaggedTemplateParserError(tagName, templates, diagnostics, result.errors[0], {
|
|
385
|
+
label: 'jsx-loader',
|
|
386
|
+
}));
|
|
384
387
|
}
|
|
385
388
|
const slots = collectSlots(result.program, templateSource);
|
|
386
389
|
return renderTemplateWithSlots(templateSource, slots);
|
|
@@ -449,6 +452,25 @@ const normalizeJsxTextSegments = (value, placeholders) => {
|
|
|
449
452
|
return segments;
|
|
450
453
|
};
|
|
451
454
|
const TAG_PLACEHOLDER_PREFIX = '__JSX_LOADER_TAG_EXPR_';
|
|
455
|
+
const materializeTemplateStrings = (quasis) => {
|
|
456
|
+
const cooked = [];
|
|
457
|
+
const raw = [];
|
|
458
|
+
quasis.forEach(quasi => {
|
|
459
|
+
const value = quasi.value;
|
|
460
|
+
const cookedChunk = typeof value.cooked === 'string' ? value.cooked : (value.raw ?? '');
|
|
461
|
+
const rawChunk = typeof value.raw === 'string' ? value.raw : cookedChunk;
|
|
462
|
+
cooked.push(cookedChunk);
|
|
463
|
+
raw.push(rawChunk);
|
|
464
|
+
});
|
|
465
|
+
const templates = cooked;
|
|
466
|
+
Object.defineProperty(templates, 'raw', {
|
|
467
|
+
value: raw,
|
|
468
|
+
writable: false,
|
|
469
|
+
configurable: false,
|
|
470
|
+
enumerable: false,
|
|
471
|
+
});
|
|
472
|
+
return templates;
|
|
473
|
+
};
|
|
452
474
|
const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
453
475
|
const placeholderMap = new Map();
|
|
454
476
|
const tagPlaceholderMap = new Map();
|
|
@@ -456,6 +478,7 @@ const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
|
456
478
|
let placeholderIndex = 0;
|
|
457
479
|
let trimStartNext = 0;
|
|
458
480
|
let mutated = false;
|
|
481
|
+
const expressionRanges = [];
|
|
459
482
|
const registerMarker = (code, isTag) => {
|
|
460
483
|
if (isTag) {
|
|
461
484
|
const existing = tagPlaceholderMap.get(code);
|
|
@@ -471,6 +494,12 @@ const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
|
471
494
|
placeholderMap.set(marker, code);
|
|
472
495
|
return marker;
|
|
473
496
|
};
|
|
497
|
+
const appendInsertion = (expressionIndex, insertion) => {
|
|
498
|
+
const start = template.length;
|
|
499
|
+
template += insertion;
|
|
500
|
+
const end = template.length;
|
|
501
|
+
expressionRanges.push({ index: expressionIndex, sourceStart: start, sourceEnd: end });
|
|
502
|
+
};
|
|
474
503
|
quasis.forEach((quasi, index) => {
|
|
475
504
|
let chunk = quasi.value.cooked;
|
|
476
505
|
if (typeof chunk !== 'string') {
|
|
@@ -488,6 +517,7 @@ const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
|
488
517
|
if (!expression) {
|
|
489
518
|
return;
|
|
490
519
|
}
|
|
520
|
+
const expressionIndex = index;
|
|
491
521
|
const start = expression.start ?? null;
|
|
492
522
|
const end = expression.end ?? null;
|
|
493
523
|
if (start === null || end === null) {
|
|
@@ -503,7 +533,8 @@ const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
|
503
533
|
const code = source.slice(start, end);
|
|
504
534
|
const marker = registerMarker(code, context.type === 'tag');
|
|
505
535
|
const appendMarker = (wrapper) => {
|
|
506
|
-
|
|
536
|
+
const insertion = wrapper ? wrapper(marker) : marker;
|
|
537
|
+
appendInsertion(expressionIndex, insertion);
|
|
507
538
|
};
|
|
508
539
|
switch (context.type) {
|
|
509
540
|
case 'tag':
|
|
@@ -545,15 +576,22 @@ const buildTemplateSource = (quasis, expressions, source, tag) => {
|
|
|
545
576
|
marker,
|
|
546
577
|
code,
|
|
547
578
|
})),
|
|
579
|
+
diagnostics: { expressionRanges },
|
|
548
580
|
};
|
|
549
581
|
};
|
|
550
582
|
const restoreTemplatePlaceholders = (code, placeholders) => placeholders.reduce((result, placeholder) => {
|
|
551
583
|
return result.split(placeholder.marker).join(`\${${placeholder.code}}`);
|
|
552
584
|
}, code);
|
|
553
|
-
const
|
|
585
|
+
const createInlineSourceMapComment = (map) => {
|
|
586
|
+
const payload = Buffer.from(JSON.stringify(map), 'utf8').toString('base64');
|
|
587
|
+
return `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${payload}`;
|
|
588
|
+
};
|
|
589
|
+
const compileReactTemplate = (templateSource, placeholders, resourcePath, tagName, templates, diagnostics) => {
|
|
554
590
|
const parsed = parseSync(`${resourcePath}?jsx-react-template`, templateSource, TEMPLATE_PARSER_OPTIONS);
|
|
555
591
|
if (parsed.errors.length > 0) {
|
|
556
|
-
throw new Error(
|
|
592
|
+
throw new Error(formatTaggedTemplateParserError(tagName, templates, diagnostics, parsed.errors[0], {
|
|
593
|
+
label: 'jsx-loader',
|
|
594
|
+
}));
|
|
557
595
|
}
|
|
558
596
|
const root = extractJsxRoot(parsed.program);
|
|
559
597
|
const builder = new ReactTemplateBuilder(placeholders);
|
|
@@ -571,7 +609,7 @@ const isLoaderPlaceholderIdentifier = (node) => {
|
|
|
571
609
|
return (node.name.startsWith(TEMPLATE_EXPR_PLACEHOLDER_PREFIX) ||
|
|
572
610
|
node.name.startsWith(TAG_PLACEHOLDER_PREFIX));
|
|
573
611
|
};
|
|
574
|
-
const transformSource = (source, config) => {
|
|
612
|
+
const transformSource = (source, config, options) => {
|
|
575
613
|
const ast = parseSync(config.resourcePath, source, MODULE_PARSER_OPTIONS);
|
|
576
614
|
if (ast.errors.length > 0) {
|
|
577
615
|
throw new Error(formatParserError(ast.errors[0]));
|
|
@@ -584,7 +622,7 @@ const transformSource = (source, config) => {
|
|
|
584
622
|
}
|
|
585
623
|
});
|
|
586
624
|
if (!taggedTemplates.length) {
|
|
587
|
-
return { code: source,
|
|
625
|
+
return { code: source, mutated: false };
|
|
588
626
|
}
|
|
589
627
|
const magic = new MagicString(source);
|
|
590
628
|
let mutated = false;
|
|
@@ -596,8 +634,9 @@ const transformSource = (source, config) => {
|
|
|
596
634
|
const mode = config.tagModes.get(tagName) ?? DEFAULT_MODE;
|
|
597
635
|
const quasi = node.quasi;
|
|
598
636
|
const templateSource = buildTemplateSource(quasi.quasis, quasi.expressions, source, tagName);
|
|
637
|
+
const templateStrings = materializeTemplateStrings(quasi.quasis);
|
|
599
638
|
if (mode === 'runtime') {
|
|
600
|
-
const { code, changed } = transformTemplateLiteral(templateSource.source, config.resourcePath);
|
|
639
|
+
const { code, changed } = transformTemplateLiteral(templateSource.source, config.resourcePath, tagName, templateStrings, templateSource.diagnostics);
|
|
601
640
|
const restored = restoreTemplatePlaceholders(code, templateSource.placeholders);
|
|
602
641
|
const templateChanged = changed || templateSource.mutated;
|
|
603
642
|
if (!templateChanged) {
|
|
@@ -610,7 +649,7 @@ const transformSource = (source, config) => {
|
|
|
610
649
|
return;
|
|
611
650
|
}
|
|
612
651
|
if (mode === 'react') {
|
|
613
|
-
const compiled = compileReactTemplate(templateSource.source, templateSource.placeholders, config.resourcePath);
|
|
652
|
+
const compiled = compileReactTemplate(templateSource.source, templateSource.placeholders, config.resourcePath, tagName, templateStrings, templateSource.diagnostics);
|
|
614
653
|
helperKinds.add('react');
|
|
615
654
|
magic.overwrite(node.start, node.end, compiled);
|
|
616
655
|
mutated = true;
|
|
@@ -621,11 +660,26 @@ const transformSource = (source, config) => {
|
|
|
621
660
|
// Modes are validated during option parsing; this fallback guards future extensions.
|
|
622
661
|
throw new Error(`[jsx-loader] Transformation mode "${mode}" not implemented yet for tag "${tagName}".`);
|
|
623
662
|
});
|
|
663
|
+
const helperSource = Array.from(helperKinds)
|
|
664
|
+
.map(kind => HELPER_SNIPPETS[kind])
|
|
665
|
+
.filter(Boolean)
|
|
666
|
+
.join('\n');
|
|
667
|
+
if (helperSource) {
|
|
668
|
+
magic.append(`\n${helperSource}`);
|
|
669
|
+
mutated = true;
|
|
670
|
+
}
|
|
671
|
+
const code = mutated ? magic.toString() : source;
|
|
672
|
+
const map = options?.sourceMap && mutated
|
|
673
|
+
? magic.generateMap({
|
|
674
|
+
hires: true,
|
|
675
|
+
source: config.resourcePath,
|
|
676
|
+
includeContent: true,
|
|
677
|
+
})
|
|
678
|
+
: undefined;
|
|
624
679
|
return {
|
|
625
|
-
code
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
.filter(Boolean),
|
|
680
|
+
code,
|
|
681
|
+
map,
|
|
682
|
+
mutated,
|
|
629
683
|
};
|
|
630
684
|
};
|
|
631
685
|
export default function jsxLoader(input) {
|
|
@@ -662,16 +716,14 @@ export default function jsxLoader(input) {
|
|
|
662
716
|
}
|
|
663
717
|
});
|
|
664
718
|
const source = typeof input === 'string' ? input : input.toString('utf8');
|
|
665
|
-
const
|
|
719
|
+
const enableSourceMap = options.sourceMap === true;
|
|
720
|
+
const { code, map } = transformSource(source, {
|
|
666
721
|
resourcePath: this.resourcePath,
|
|
667
722
|
tags,
|
|
668
723
|
tagModes,
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
callback(null, code);
|
|
724
|
+
}, { sourceMap: enableSourceMap });
|
|
725
|
+
const output = map && enableSourceMap ? `${code}\n${createInlineSourceMapComment(map)}` : code;
|
|
726
|
+
callback(null, output, map);
|
|
675
727
|
}
|
|
676
728
|
catch (error) {
|
|
677
729
|
callback(error);
|
package/dist/react/react-jsx.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSync } from 'oxc-parser';
|
|
2
|
-
import { buildTemplate, evaluateExpression, extractRootNode,
|
|
2
|
+
import { buildTemplate, evaluateExpression, extractRootNode, formatTaggedTemplateParserError, getIdentifierName, normalizeJsxTextSegments, parserOptions, } from '../runtime/shared.js';
|
|
3
3
|
import { Fragment, createElement, } from 'react';
|
|
4
4
|
const isIterable = (value) => {
|
|
5
5
|
if (!value || typeof value === 'string') {
|
|
@@ -124,7 +124,7 @@ export const reactJsx = (templates, ...values) => {
|
|
|
124
124
|
const build = buildTemplate(templates, values);
|
|
125
125
|
const result = parseSync('inline.jsx', build.source, parserOptions);
|
|
126
126
|
if (result.errors.length > 0) {
|
|
127
|
-
throw new Error(
|
|
127
|
+
throw new Error(formatTaggedTemplateParserError('reactJsx', templates, build.diagnostics, result.errors[0]));
|
|
128
128
|
}
|
|
129
129
|
const root = extractRootNode(result.program);
|
|
130
130
|
const ctx = {
|
package/dist/runtime/shared.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Expression, JSXElement, JSXFragment, JSXIdentifier, JSXMemberExpression, JSXNamespacedName, Program } from '@oxc-project/types';
|
|
2
2
|
import type { OxcError, ParserOptions } from 'oxc-parser';
|
|
3
|
+
import type { TemplateDiagnostics } from '../internal/template-diagnostics.js';
|
|
4
|
+
export { formatTaggedTemplateParserError } from '../internal/template-diagnostics.js';
|
|
5
|
+
export type { TemplateDiagnostics, TemplateExpressionRange, } from '../internal/template-diagnostics.js';
|
|
3
6
|
export declare const PLACEHOLDER_PREFIX = "__KX_EXPR__";
|
|
4
7
|
export declare const placeholderPattern: RegExp;
|
|
8
|
+
export declare const formatParserError: (error: OxcError) => string;
|
|
5
9
|
type AnyTemplateFunction = (...args: any[]) => unknown;
|
|
6
10
|
type AnyTemplateConstructor = abstract new (...args: any[]) => unknown;
|
|
7
11
|
export type TemplateComponent = (AnyTemplateFunction | AnyTemplateConstructor) & {
|
|
@@ -16,6 +20,7 @@ export type TemplateBuildResult<TComponent extends TemplateComponent> = {
|
|
|
16
20
|
source: string;
|
|
17
21
|
placeholders: Map<string, unknown>;
|
|
18
22
|
bindings: BindingEntry<TComponent>[];
|
|
23
|
+
diagnostics: TemplateDiagnostics;
|
|
19
24
|
};
|
|
20
25
|
export type TemplateContext<TComponent extends TemplateComponent> = {
|
|
21
26
|
source: string;
|
|
@@ -23,7 +28,6 @@ export type TemplateContext<TComponent extends TemplateComponent> = {
|
|
|
23
28
|
components: Map<string, TComponent>;
|
|
24
29
|
};
|
|
25
30
|
export declare const parserOptions: ParserOptions;
|
|
26
|
-
export declare const formatParserError: (error: OxcError) => string;
|
|
27
31
|
export declare const extractRootNode: (program: Program) => JSXElement | JSXFragment;
|
|
28
32
|
export declare const getIdentifierName: (identifier: JSXIdentifier | JSXNamespacedName | JSXMemberExpression) => string;
|
|
29
33
|
type AnyOxcNode = {
|
|
@@ -37,4 +41,3 @@ export declare const evaluateExpression: <TComponent extends TemplateComponent>(
|
|
|
37
41
|
export declare const sanitizeIdentifier: (value: string) => string;
|
|
38
42
|
export declare const ensureBinding: <TComponent extends TemplateComponent>(value: TComponent, bindings: BindingEntry<TComponent>[], bindingLookup: Map<TComponent, BindingEntry<TComponent>>) => BindingEntry<TComponent>;
|
|
39
43
|
export declare const buildTemplate: <TComponent extends TemplateComponent>(strings: TemplateStringsArray, values: unknown[]) => TemplateBuildResult<TComponent>;
|
|
40
|
-
export {};
|
package/dist/runtime/shared.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
+
export { formatTaggedTemplateParserError } from '../internal/template-diagnostics.js';
|
|
1
2
|
const OPEN_TAG_RE = /<\s*$/;
|
|
2
3
|
const CLOSE_TAG_RE = /<\/\s*$/;
|
|
3
4
|
export const PLACEHOLDER_PREFIX = '__KX_EXPR__';
|
|
4
5
|
export const placeholderPattern = new RegExp(`${PLACEHOLDER_PREFIX}\\d+_\\d+__`, 'g');
|
|
5
6
|
let invocationCounter = 0;
|
|
6
|
-
export const parserOptions = {
|
|
7
|
-
lang: 'jsx',
|
|
8
|
-
sourceType: 'module',
|
|
9
|
-
range: true,
|
|
10
|
-
preserveParens: true,
|
|
11
|
-
};
|
|
12
7
|
export const formatParserError = (error) => {
|
|
13
8
|
let message = `[oxc-parser] ${error.message}`;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
message += `\n${label.message}`;
|
|
18
|
-
}
|
|
9
|
+
const primaryLabel = error.labels?.[0];
|
|
10
|
+
if (primaryLabel?.message) {
|
|
11
|
+
message += `\n${primaryLabel.message}`;
|
|
19
12
|
}
|
|
20
13
|
if (error.codeframe) {
|
|
21
14
|
message += `\n${error.codeframe}`;
|
|
22
15
|
}
|
|
16
|
+
if (error.helpMessage) {
|
|
17
|
+
message += `\n${error.helpMessage}`;
|
|
18
|
+
}
|
|
23
19
|
return message;
|
|
24
20
|
};
|
|
21
|
+
export const parserOptions = {
|
|
22
|
+
lang: 'jsx',
|
|
23
|
+
sourceType: 'module',
|
|
24
|
+
range: true,
|
|
25
|
+
preserveParens: true,
|
|
26
|
+
};
|
|
25
27
|
export const extractRootNode = (program) => {
|
|
26
28
|
for (const statement of program.body) {
|
|
27
29
|
if (statement.type === 'ExpressionStatement') {
|
|
@@ -171,23 +173,39 @@ export const buildTemplate = (strings, values) => {
|
|
|
171
173
|
let source = raw[0] ?? '';
|
|
172
174
|
const templateId = invocationCounter++;
|
|
173
175
|
let placeholderIndex = 0;
|
|
176
|
+
const expressionRanges = [];
|
|
174
177
|
for (let idx = 0; idx < values.length; idx++) {
|
|
175
178
|
const chunk = raw[idx] ?? '';
|
|
176
179
|
const nextChunk = raw[idx + 1] ?? '';
|
|
177
180
|
const value = values[idx];
|
|
178
181
|
const isTagNamePosition = OPEN_TAG_RE.test(chunk) || CLOSE_TAG_RE.test(chunk);
|
|
182
|
+
let insertion;
|
|
179
183
|
if (isTagNamePosition && typeof value === 'function') {
|
|
180
184
|
const binding = ensureBinding(value, bindings, bindingLookup);
|
|
181
|
-
|
|
182
|
-
continue;
|
|
185
|
+
insertion = binding.name;
|
|
183
186
|
}
|
|
184
|
-
if (isTagNamePosition && typeof value === 'string') {
|
|
185
|
-
|
|
186
|
-
continue;
|
|
187
|
+
else if (isTagNamePosition && typeof value === 'string') {
|
|
188
|
+
insertion = value;
|
|
187
189
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
else {
|
|
191
|
+
const placeholder = `${PLACEHOLDER_PREFIX}${templateId}_${placeholderIndex++}__`;
|
|
192
|
+
placeholders.set(placeholder, value);
|
|
193
|
+
insertion = placeholder;
|
|
194
|
+
}
|
|
195
|
+
const sourceStart = source.length;
|
|
196
|
+
source += insertion;
|
|
197
|
+
const sourceEnd = source.length;
|
|
198
|
+
expressionRanges.push({
|
|
199
|
+
index: idx,
|
|
200
|
+
sourceStart,
|
|
201
|
+
sourceEnd,
|
|
202
|
+
});
|
|
203
|
+
source += nextChunk;
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
source,
|
|
207
|
+
placeholders,
|
|
208
|
+
bindings,
|
|
209
|
+
diagnostics: { expressionRanges },
|
|
210
|
+
};
|
|
193
211
|
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knighted/jsx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Runtime JSX tagged template that renders DOM or React trees anywhere without a build step.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx runtime",
|
|
7
|
-
"jsx template literal",
|
|
8
7
|
"tagged template",
|
|
9
8
|
"no-build jsx",
|
|
10
|
-
"dom
|
|
11
|
-
"react
|
|
9
|
+
"dom rendering",
|
|
10
|
+
"react rendering",
|
|
12
11
|
"ssr",
|
|
13
|
-
"
|
|
12
|
+
"rspack loader",
|
|
14
13
|
"webpack loader",
|
|
15
|
-
"
|
|
14
|
+
"wasm parser",
|
|
15
|
+
"typescript plugin"
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "./dist/index.js",
|
|
@@ -36,11 +36,31 @@
|
|
|
36
36
|
"import": "./dist/jsx-runtime.js",
|
|
37
37
|
"default": "./dist/jsx-runtime.js"
|
|
38
38
|
},
|
|
39
|
+
"./debug": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"import": "./dist/debug/index.js",
|
|
42
|
+
"default": "./dist/debug/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./debug-tools": {
|
|
45
|
+
"types": "./dist/debug/diagnostics.d.ts",
|
|
46
|
+
"import": "./dist/debug/diagnostics.js",
|
|
47
|
+
"default": "./dist/debug/diagnostics.js"
|
|
48
|
+
},
|
|
39
49
|
"./lite": {
|
|
40
50
|
"types": "./dist/index.d.ts",
|
|
41
51
|
"import": "./dist/lite/index.js",
|
|
42
52
|
"default": "./dist/lite/index.js"
|
|
43
53
|
},
|
|
54
|
+
"./lite/debug": {
|
|
55
|
+
"types": "./dist/index.d.ts",
|
|
56
|
+
"import": "./dist/lite/debug/index.js",
|
|
57
|
+
"default": "./dist/lite/debug/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./lite/debug-tools": {
|
|
60
|
+
"types": "./dist/debug/diagnostics.d.ts",
|
|
61
|
+
"import": "./dist/lite/debug/diagnostics.js",
|
|
62
|
+
"default": "./dist/lite/debug/diagnostics.js"
|
|
63
|
+
},
|
|
44
64
|
"./react": {
|
|
45
65
|
"types": "./dist/react/index.d.ts",
|
|
46
66
|
"import": "./dist/react/index.js",
|
|
@@ -56,11 +76,21 @@
|
|
|
56
76
|
"import": "./dist/node/index.js",
|
|
57
77
|
"default": "./dist/node/index.js"
|
|
58
78
|
},
|
|
79
|
+
"./node/debug": {
|
|
80
|
+
"types": "./dist/node/index.d.ts",
|
|
81
|
+
"import": "./dist/node/debug/index.js",
|
|
82
|
+
"default": "./dist/node/debug/index.js"
|
|
83
|
+
},
|
|
59
84
|
"./node/lite": {
|
|
60
85
|
"types": "./dist/node/index.d.ts",
|
|
61
86
|
"import": "./dist/lite/node/index.js",
|
|
62
87
|
"default": "./dist/lite/node/index.js"
|
|
63
88
|
},
|
|
89
|
+
"./node/lite/debug": {
|
|
90
|
+
"types": "./dist/node/index.d.ts",
|
|
91
|
+
"import": "./dist/lite/node/debug/index.js",
|
|
92
|
+
"default": "./dist/lite/node/debug/index.js"
|
|
93
|
+
},
|
|
64
94
|
"./node/react": {
|
|
65
95
|
"types": "./dist/node/react/index.d.ts",
|
|
66
96
|
"import": "./dist/node/react/index.js",
|
|
@@ -85,9 +115,10 @@
|
|
|
85
115
|
"build": "duel && npm run build:lite && npm run build:cli",
|
|
86
116
|
"prepare": "husky",
|
|
87
117
|
"precheck-types": "npm run build",
|
|
88
|
-
"check-types": "npm run check-types:lib && npm run check-types:demo",
|
|
118
|
+
"check-types": "npm run check-types:lib && npm run check-types:demo && npm run check-types:test",
|
|
89
119
|
"check-types:lib": "tsc --noEmit --project tsconfig.json",
|
|
90
120
|
"check-types:demo": "tsc --noEmit --project examples/browser/tsconfig.json",
|
|
121
|
+
"check-types:test": "tsc --noEmit --project tsconfig.vitest.json",
|
|
91
122
|
"lint": "eslint src test",
|
|
92
123
|
"cycles": "madge src --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json",
|
|
93
124
|
"prettier": "prettier -w .",
|
|
@@ -103,6 +134,7 @@
|
|
|
103
134
|
"build:lite": "tsup --config tsup.config.ts",
|
|
104
135
|
"build:cli": "tsup --config tsup.cli.config.ts",
|
|
105
136
|
"setup:wasm": "node scripts/setup-wasm.mjs",
|
|
137
|
+
"sizecheck": "node scripts/sizecheck.mjs",
|
|
106
138
|
"prepack": "npm run build"
|
|
107
139
|
},
|
|
108
140
|
"devDependencies": {
|