@vue-jsx-vapor/compiler 2.6.0 → 2.6.2

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/dist/index.cjs CHANGED
@@ -1573,6 +1573,7 @@ function generate(ir, options = {}) {
1573
1573
  //#endregion
1574
1574
  //#region src/transform.ts
1575
1575
  const defaultOptions = {
1576
+ source: "",
1576
1577
  filename: "",
1577
1578
  hoistStatic: false,
1578
1579
  hmr: false,
@@ -1590,6 +1591,7 @@ const defaultOptions = {
1590
1591
  inSSR: false,
1591
1592
  ssrCssVars: ``,
1592
1593
  isTS: false,
1594
+ withFallback: false,
1593
1595
  onError: __vue_compiler_dom.defaultOnError,
1594
1596
  onWarn: __vue_compiler_dom.defaultOnWarn
1595
1597
  };
@@ -1807,20 +1809,13 @@ const transformElement = (node, context) => {
1807
1809
  };
1808
1810
  };
1809
1811
  function transformComponentElement(tag, propsResult, singleRoot, context) {
1810
- let asset = true;
1811
- const fromSetup = tag;
1812
- if (fromSetup) {
1813
- tag = fromSetup;
1814
- asset = false;
1815
- }
1812
+ let asset = context.options.withFallback;
1816
1813
  const dotIndex = tag.indexOf(".");
1817
1814
  if (dotIndex > 0) {
1818
1815
  const ns = tag.slice(0, dotIndex);
1819
- if (ns) {
1820
- tag = ns + tag.slice(dotIndex);
1821
- asset = false;
1822
- }
1816
+ if (ns) tag = ns + tag.slice(dotIndex);
1823
1817
  }
1818
+ if (tag.includes("-")) asset = true;
1824
1819
  if (asset) context.component.add(tag);
1825
1820
  context.dynamic.flags |= DynamicFlag.NON_TEMPLATE | DynamicFlag.INSERT;
1826
1821
  context.dynamic.operation = {
package/dist/index.d.cts CHANGED
@@ -17,7 +17,13 @@ interface DirectiveTransformResult {
17
17
  }
18
18
  type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
19
19
  type TransformOptions = HackOptions<TransformOptions$1> & {
20
+ source?: string;
20
21
  templates?: string[];
22
+ /**
23
+ * Compile JSX Component to createComponentWithFallback.
24
+ * @default false
25
+ */
26
+ withFallback?: boolean;
21
27
  };
22
28
  declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
23
29
  ir: RootIRNode;
@@ -370,10 +376,7 @@ declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodege
370
376
  //#endregion
371
377
  //#region src/compile.d.ts
372
378
  declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
373
- type CompilerOptions = HackOptions<CompilerOptions$1> & {
374
- source?: string;
375
- templates?: string[];
376
- };
379
+ type CompilerOptions = HackOptions<CompilerOptions$1> & TransformOptions;
377
380
  type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
378
381
  //#endregion
379
382
  //#region src/transforms/transformText.d.ts
package/dist/index.d.ts CHANGED
@@ -17,7 +17,13 @@ interface DirectiveTransformResult {
17
17
  }
18
18
  type StructuralDirectiveTransform = (node: JSXElement, dir: JSXAttribute, context: TransformContext) => void | (() => void);
19
19
  type TransformOptions = HackOptions<TransformOptions$1> & {
20
+ source?: string;
20
21
  templates?: string[];
22
+ /**
23
+ * Compile JSX Component to createComponentWithFallback.
24
+ * @default false
25
+ */
26
+ withFallback?: boolean;
21
27
  };
22
28
  declare class TransformContext<T extends BlockIRNode['node'] = BlockIRNode['node']> {
23
29
  ir: RootIRNode;
@@ -370,10 +376,7 @@ declare function generate(ir: RootIRNode, options?: CodegenOptions): VaporCodege
370
376
  //#endregion
371
377
  //#region src/compile.d.ts
372
378
  declare function compile(source: JSXElement | JSXFragment | string, options?: CompilerOptions): VaporCodegenResult;
373
- type CompilerOptions = HackOptions<CompilerOptions$1> & {
374
- source?: string;
375
- templates?: string[];
376
- };
379
+ type CompilerOptions = HackOptions<CompilerOptions$1> & TransformOptions;
377
380
  type TransformPreset = [NodeTransform[], Record<string, DirectiveTransform>];
378
381
  //#endregion
379
382
  //#region src/transforms/transformText.d.ts
package/dist/index.js CHANGED
@@ -1550,6 +1550,7 @@ function generate(ir, options = {}) {
1550
1550
  //#endregion
1551
1551
  //#region src/transform.ts
1552
1552
  const defaultOptions = {
1553
+ source: "",
1553
1554
  filename: "",
1554
1555
  hoistStatic: false,
1555
1556
  hmr: false,
@@ -1567,6 +1568,7 @@ const defaultOptions = {
1567
1568
  inSSR: false,
1568
1569
  ssrCssVars: ``,
1569
1570
  isTS: false,
1571
+ withFallback: false,
1570
1572
  onError: defaultOnError,
1571
1573
  onWarn: defaultOnWarn
1572
1574
  };
@@ -1784,20 +1786,13 @@ const transformElement = (node, context) => {
1784
1786
  };
1785
1787
  };
1786
1788
  function transformComponentElement(tag, propsResult, singleRoot, context) {
1787
- let asset = true;
1788
- const fromSetup = tag;
1789
- if (fromSetup) {
1790
- tag = fromSetup;
1791
- asset = false;
1792
- }
1789
+ let asset = context.options.withFallback;
1793
1790
  const dotIndex = tag.indexOf(".");
1794
1791
  if (dotIndex > 0) {
1795
1792
  const ns = tag.slice(0, dotIndex);
1796
- if (ns) {
1797
- tag = ns + tag.slice(dotIndex);
1798
- asset = false;
1799
- }
1793
+ if (ns) tag = ns + tag.slice(dotIndex);
1800
1794
  }
1795
+ if (tag.includes("-")) asset = true;
1801
1796
  if (asset) context.component.add(tag);
1802
1797
  context.dynamic.flags |= DynamicFlag.NON_TEMPLATE | DynamicFlag.INSERT;
1803
1798
  context.dynamic.operation = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/compiler",
3
- "version": "2.6.0",
3
+ "version": "2.6.2",
4
4
  "description": "Vue JSX Vapor Compiler",
5
5
  "type": "module",
6
6
  "keywords": [