@zessjs/compiler 1.0.6 → 1.0.8
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/compiler.cjs +16 -15
- package/dist/compiler.d.cts +8 -9
- package/dist/compiler.d.ts +8 -9
- package/dist/compiler.js +5 -8
- package/package.json +2 -2
package/dist/compiler.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
//#region rolldown:runtime
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -22,11 +21,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
21
|
}) : target, mod));
|
|
23
22
|
|
|
24
23
|
//#endregion
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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);
|
|
30
34
|
|
|
31
35
|
//#region src/visit.ts
|
|
32
36
|
const ESTreeNodeKeys = {
|
|
@@ -464,8 +468,8 @@ function compile(code, options = {}) {
|
|
|
464
468
|
},
|
|
465
469
|
ast,
|
|
466
470
|
events: [],
|
|
467
|
-
eventsCache: new Set(),
|
|
468
|
-
generatedFunctions: new WeakSet()
|
|
471
|
+
eventsCache: /* @__PURE__ */ new Set(),
|
|
472
|
+
generatedFunctions: /* @__PURE__ */ new WeakSet()
|
|
469
473
|
};
|
|
470
474
|
visit(ast, {
|
|
471
475
|
JSXElement(node) {
|
|
@@ -477,8 +481,7 @@ function compile(code, options = {}) {
|
|
|
477
481
|
if (stmts.length === 1) if (stmts[0].type === "VariableDeclaration") expression = stmts[0].declarations[0].init;
|
|
478
482
|
else expression = stmts[0].expression;
|
|
479
483
|
else {
|
|
480
|
-
const
|
|
481
|
-
const id = stmt.declarations[0].id;
|
|
484
|
+
const id = stmts[0].declarations[0].id;
|
|
482
485
|
const callExpressionPosition = copyPosition(node);
|
|
483
486
|
expression = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, callExpressionPosition)], callExpressionPosition), callExpressionPosition), [], callExpressionPosition);
|
|
484
487
|
}
|
|
@@ -597,8 +600,7 @@ function transformFragment(children, position, isInComponent) {
|
|
|
597
600
|
const stmts = transformElement(childNode);
|
|
598
601
|
if (isInComponent) hasDynamicChildren = true;
|
|
599
602
|
if (stmts.length > 1) {
|
|
600
|
-
const
|
|
601
|
-
const id = stmt.declarations[0].id;
|
|
603
|
+
const id = stmts[0].declarations[0].id;
|
|
602
604
|
childElement = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, childPosition)], childPosition), childPosition), [], childPosition);
|
|
603
605
|
} else if (stmts[0].type === "VariableDeclaration") childElement = stmts[0].declarations[0].init;
|
|
604
606
|
else childElement = stmts[0].expression;
|
|
@@ -1095,8 +1097,7 @@ function transformProperties(attrs, children, position) {
|
|
|
1095
1097
|
}
|
|
1096
1098
|
function getAttributeName(node) {
|
|
1097
1099
|
if (node.type === "JSXIdentifier") return node.name;
|
|
1098
|
-
|
|
1099
|
-
return `${namespace.name}:${node.name.name}`;
|
|
1100
|
+
return `${node.namespace.name}:${node.name.name}`;
|
|
1100
1101
|
}
|
|
1101
1102
|
function copyPosition(node) {
|
|
1102
1103
|
return {
|
|
@@ -1372,4 +1373,4 @@ function isDynamicExpression(node, checkTags) {
|
|
|
1372
1373
|
}
|
|
1373
1374
|
|
|
1374
1375
|
//#endregion
|
|
1375
|
-
exports.compile = compile
|
|
1376
|
+
exports.compile = compile;
|
package/dist/compiler.d.cts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { ESTree } from "meriyah";
|
|
2
2
|
import { RawSourceMap } from "source-map";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region src/compiler.d.ts
|
|
5
5
|
type CompilerOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
modulePath?: string;
|
|
7
|
+
file?: string;
|
|
8
|
+
sourceRoot?: string;
|
|
9
|
+
sourcemap?: RawSourceMap;
|
|
10
10
|
};
|
|
11
11
|
type CompilerResult = {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
code: string;
|
|
13
|
+
map: RawSourceMap;
|
|
14
14
|
};
|
|
15
15
|
declare function compile(code: string, options?: CompilerOptions): CompilerResult;
|
|
16
|
-
|
|
17
16
|
//#endregion
|
|
18
|
-
export { ESTree, RawSourceMap, compile };
|
|
17
|
+
export { type ESTree, type RawSourceMap, compile };
|
package/dist/compiler.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { ESTree } from "meriyah";
|
|
2
2
|
import { RawSourceMap } from "source-map";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region src/compiler.d.ts
|
|
5
5
|
type CompilerOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
modulePath?: string;
|
|
7
|
+
file?: string;
|
|
8
|
+
sourceRoot?: string;
|
|
9
|
+
sourcemap?: RawSourceMap;
|
|
10
10
|
};
|
|
11
11
|
type CompilerResult = {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
code: string;
|
|
13
|
+
map: RawSourceMap;
|
|
14
14
|
};
|
|
15
15
|
declare function compile(code: string, options?: CompilerOptions): CompilerResult;
|
|
16
|
-
|
|
17
16
|
//#endregion
|
|
18
|
-
export { ESTree, RawSourceMap, compile };
|
|
17
|
+
export { type ESTree, type 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: new Set(),
|
|
444
|
-
generatedFunctions: new WeakSet()
|
|
443
|
+
eventsCache: /* @__PURE__ */ new Set(),
|
|
444
|
+
generatedFunctions: /* @__PURE__ */ new WeakSet()
|
|
445
445
|
};
|
|
446
446
|
visit(ast, {
|
|
447
447
|
JSXElement(node) {
|
|
@@ -453,8 +453,7 @@ 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
|
|
457
|
-
const id = stmt.declarations[0].id;
|
|
456
|
+
const id = stmts[0].declarations[0].id;
|
|
458
457
|
const callExpressionPosition = copyPosition(node);
|
|
459
458
|
expression = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, callExpressionPosition)], callExpressionPosition), callExpressionPosition), [], callExpressionPosition);
|
|
460
459
|
}
|
|
@@ -573,8 +572,7 @@ function transformFragment(children, position, isInComponent) {
|
|
|
573
572
|
const stmts = transformElement(childNode);
|
|
574
573
|
if (isInComponent) hasDynamicChildren = true;
|
|
575
574
|
if (stmts.length > 1) {
|
|
576
|
-
const
|
|
577
|
-
const id = stmt.declarations[0].id;
|
|
575
|
+
const id = stmts[0].declarations[0].id;
|
|
578
576
|
childElement = createCallExpression(createArrowFunctionExpression(createBlockStatement([...stmts, createReturnStatement(id, childPosition)], childPosition), childPosition), [], childPosition);
|
|
579
577
|
} else if (stmts[0].type === "VariableDeclaration") childElement = stmts[0].declarations[0].init;
|
|
580
578
|
else childElement = stmts[0].expression;
|
|
@@ -1071,8 +1069,7 @@ function transformProperties(attrs, children, position) {
|
|
|
1071
1069
|
}
|
|
1072
1070
|
function getAttributeName(node) {
|
|
1073
1071
|
if (node.type === "JSXIdentifier") return node.name;
|
|
1074
|
-
|
|
1075
|
-
return `${namespace.name}:${node.name.name}`;
|
|
1072
|
+
return `${node.namespace.name}:${node.name.name}`;
|
|
1076
1073
|
}
|
|
1077
1074
|
function copyPosition(node) {
|
|
1078
1075
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zessjs/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Zess JSX compiler 💥 Delivers efficient code conversion for super - responsive web experiences.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"astring": "^1.9.0",
|
|
39
|
-
"entities": "^
|
|
39
|
+
"entities": "^7.0.0",
|
|
40
40
|
"merge-source-map": "^1.1.0",
|
|
41
41
|
"meriyah": "^6.1.4",
|
|
42
42
|
"source-map": "^0.7.6"
|