@zessjs/compiler 1.0.0 → 1.0.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 CHANGED
@@ -1,5 +1,7 @@
1
1
  <div align="center">
2
- <img src="https://pic1.imgdb.cn/item/68c7c093c5157e1a8804fb52.svg" alt="Zess Logo">
2
+ <a href="https://rpsffx.github.io/zess" target="_blank" alt="Zess Logo">
3
+ <img src="https://pic1.imgdb.cn/item/68c7c093c5157e1a8804fb52.svg" alt="Zess Logo">
4
+ </a>
3
5
  </div>
4
6
 
5
7
  # @zessjs/compiler
@@ -423,7 +425,7 @@ const withRefs = [
423
425
 
424
426
  The Zess JSX compiler is compatible with:
425
427
 
426
- - Node.js >=18.12.0
428
+ - Node.js >=18.0.0
427
429
  - Modern browsers (Chrome, Firefox, Safari, Edge)
428
430
 
429
431
  ## 📝 License
package/dist/compiler.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  //#region rolldown:runtime
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -21,16 +22,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
22
  }) : target, mod));
22
23
 
23
24
  //#endregion
24
- let astring = require("astring");
25
- astring = __toESM(astring);
26
- let entities = require("entities");
27
- entities = __toESM(entities);
28
- let merge_source_map = require("merge-source-map");
29
- merge_source_map = __toESM(merge_source_map);
30
- let meriyah = require("meriyah");
31
- meriyah = __toESM(meriyah);
32
- let source_map = require("source-map");
33
- source_map = __toESM(source_map);
25
+ const astring = __toESM(require("astring"));
26
+ const entities = __toESM(require("entities"));
27
+ const merge_source_map = __toESM(require("merge-source-map"));
28
+ const meriyah = __toESM(require("meriyah"));
29
+ const source_map = __toESM(require("source-map"));
34
30
 
35
31
  //#region src/visit.ts
36
32
  const ESTreeNodeKeys = {
@@ -468,8 +464,8 @@ function compile(code, options = {}) {
468
464
  },
469
465
  ast,
470
466
  events: [],
471
- eventsCache: /* @__PURE__ */ new Set(),
472
- generatedFunctions: /* @__PURE__ */ new WeakSet()
467
+ eventsCache: new Set(),
468
+ generatedFunctions: new WeakSet()
473
469
  };
474
470
  visit(ast, {
475
471
  JSXElement(node) {
@@ -481,7 +477,8 @@ function compile(code, options = {}) {
481
477
  if (stmts.length === 1) if (stmts[0].type === "VariableDeclaration") expression = stmts[0].declarations[0].init;
482
478
  else expression = stmts[0].expression;
483
479
  else {
484
- const id = stmts[0].declarations[0].id;
480
+ const stmt = stmts[0];
481
+ const id = stmt.declarations[0].id;
485
482
  const callExpressionPosition = copyPosition(node);
486
483
  expression = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, callExpressionPosition)], callExpressionPosition), callExpressionPosition), [], callExpressionPosition);
487
484
  }
@@ -600,7 +597,8 @@ function transformFragment(children, position, isInComponent) {
600
597
  const stmts = transformElement(childNode);
601
598
  if (isInComponent) hasDynamicChildren = true;
602
599
  if (stmts.length > 1) {
603
- const id = stmts[0].declarations[0].id;
600
+ const stmt = stmts[0];
601
+ const id = stmt.declarations[0].id;
604
602
  childElement = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, childPosition)], childPosition), childPosition), [], childPosition);
605
603
  } else if (stmts[0].type === "VariableDeclaration") childElement = stmts[0].declarations[0].init;
606
604
  else childElement = stmts[0].expression;
@@ -1097,7 +1095,8 @@ function transformProperties(attrs, children, position) {
1097
1095
  }
1098
1096
  function getAttributeName(node) {
1099
1097
  if (node.type === "JSXIdentifier") return node.name;
1100
- return `${node.namespace.name}:${node.name.name}`;
1098
+ const namespace = node.namespace;
1099
+ return `${namespace.name}:${node.name.name}`;
1101
1100
  }
1102
1101
  function copyPosition(node) {
1103
1102
  return {
@@ -1373,4 +1372,4 @@ function isDynamicExpression(node, checkTags) {
1373
1372
  }
1374
1373
 
1375
1374
  //#endregion
1376
- exports.compile = compile;
1375
+ exports.compile = compile
@@ -1,7 +1,7 @@
1
- export { ESTree } from 'meriyah';
2
- import { RawSourceMap } from 'source-map';
3
- export { RawSourceMap } from 'source-map';
1
+ import { ESTree } from "meriyah";
2
+ import { RawSourceMap } from "source-map";
4
3
 
4
+ //#region dist/.tsdown-types-cjs/compiler.d.cts
5
5
  type CompilerOptions = {
6
6
  modulePath?: string
7
7
  file?: string
@@ -14,4 +14,5 @@ type CompilerResult = {
14
14
  };
15
15
  declare function compile(code: string, options?: CompilerOptions): CompilerResult;
16
16
 
17
- export { compile };
17
+ //#endregion
18
+ export { ESTree, RawSourceMap, compile };
@@ -1,7 +1,7 @@
1
- export { ESTree } from 'meriyah';
2
- import { RawSourceMap } from 'source-map';
3
- export { RawSourceMap } from 'source-map';
1
+ import { ESTree } from "meriyah";
2
+ import { RawSourceMap } from "source-map";
4
3
 
4
+ //#region dist/.tsdown-types-es/compiler.d.ts
5
5
  type CompilerOptions = {
6
6
  modulePath?: string
7
7
  file?: string
@@ -14,4 +14,5 @@ type CompilerResult = {
14
14
  };
15
15
  declare function compile(code: string, options?: CompilerOptions): CompilerResult;
16
16
 
17
- export { compile };
17
+ //#endregion
18
+ export { ESTree, RawSourceMap, compile };
package/dist/compiler.js CHANGED
@@ -440,8 +440,8 @@ function compile(code, options = {}) {
440
440
  },
441
441
  ast,
442
442
  events: [],
443
- eventsCache: /* @__PURE__ */ new Set(),
444
- generatedFunctions: /* @__PURE__ */ new WeakSet()
443
+ eventsCache: new Set(),
444
+ generatedFunctions: new WeakSet()
445
445
  };
446
446
  visit(ast, {
447
447
  JSXElement(node) {
@@ -453,7 +453,8 @@ function compile(code, options = {}) {
453
453
  if (stmts.length === 1) if (stmts[0].type === "VariableDeclaration") expression = stmts[0].declarations[0].init;
454
454
  else expression = stmts[0].expression;
455
455
  else {
456
- const id = stmts[0].declarations[0].id;
456
+ const stmt = stmts[0];
457
+ const id = stmt.declarations[0].id;
457
458
  const callExpressionPosition = copyPosition(node);
458
459
  expression = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, callExpressionPosition)], callExpressionPosition), callExpressionPosition), [], callExpressionPosition);
459
460
  }
@@ -572,7 +573,8 @@ function transformFragment(children, position, isInComponent) {
572
573
  const stmts = transformElement(childNode);
573
574
  if (isInComponent) hasDynamicChildren = true;
574
575
  if (stmts.length > 1) {
575
- const id = stmts[0].declarations[0].id;
576
+ const stmt = stmts[0];
577
+ const id = stmt.declarations[0].id;
576
578
  childElement = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, childPosition)], childPosition), childPosition), [], childPosition);
577
579
  } else if (stmts[0].type === "VariableDeclaration") childElement = stmts[0].declarations[0].init;
578
580
  else childElement = stmts[0].expression;
@@ -1069,7 +1071,8 @@ function transformProperties(attrs, children, position) {
1069
1071
  }
1070
1072
  function getAttributeName(node) {
1071
1073
  if (node.type === "JSXIdentifier") return node.name;
1072
- return `${node.namespace.name}:${node.name.name}`;
1074
+ const namespace = node.namespace;
1075
+ return `${namespace.name}:${node.name.name}`;
1073
1076
  }
1074
1077
  function copyPosition(node) {
1075
1078
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zessjs/compiler",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Zess JSX compiler 💥 Delivers efficient code conversion for super - responsive web experiences.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "source-map": "^0.7.6"
43
43
  },
44
44
  "engines": {
45
- "node": ">=18.12.0"
45
+ "node": ">=18.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsdown",