@jay-framework/compiler-shared 0.6.7 → 0.6.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/index.js +90 -106
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
3
|
var __publicField = (obj, key, value) => {
|
|
5
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
5
|
return value;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const jsBeautify = require("js-beautify");
|
|
11
|
-
function _interopNamespaceDefault(e) {
|
|
12
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
|
-
if (e) {
|
|
14
|
-
for (const k in e) {
|
|
15
|
-
if (k !== "default") {
|
|
16
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: () => e[k]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
const prettier__namespace = /* @__PURE__ */ _interopNamespaceDefault(prettier);
|
|
7
|
+
import * as prettier from "prettier";
|
|
8
|
+
import jsBeautify from "js-beautify";
|
|
28
9
|
const JAY_EXTENSION = ".jay-html";
|
|
29
10
|
const CSS_EXTENSION = ".css";
|
|
30
11
|
const JAY_CONTRACT_EXTENSION = ".jay-contract";
|
|
@@ -47,8 +28,8 @@ var ImportsFor = /* @__PURE__ */ ((ImportsFor2) => {
|
|
|
47
28
|
return ImportsFor2;
|
|
48
29
|
})(ImportsFor || {});
|
|
49
30
|
let nextKey = 0;
|
|
50
|
-
function importStatementFragment(
|
|
51
|
-
return { module
|
|
31
|
+
function importStatementFragment(module, statement, ...usage) {
|
|
32
|
+
return { module, index: nextKey++, statement, usage };
|
|
52
33
|
}
|
|
53
34
|
const importsOrder = {
|
|
54
35
|
JAY_RUNTIME: 1,
|
|
@@ -411,7 +392,7 @@ class Imports {
|
|
|
411
392
|
(a, b) => (importsOrder[a] || 999) - (importsOrder[b] || 999)
|
|
412
393
|
);
|
|
413
394
|
return modulesToImport.map(
|
|
414
|
-
(
|
|
395
|
+
(module) => `import {${moduleImportStatements.get(module).join(", ")}} from "${module}";`
|
|
415
396
|
).join("\n");
|
|
416
397
|
}
|
|
417
398
|
static none() {
|
|
@@ -838,9 +819,10 @@ Caused by
|
|
|
838
819
|
${originalError.stack}`;
|
|
839
820
|
return error;
|
|
840
821
|
}
|
|
822
|
+
const { html: htmlBeautify } = jsBeautify;
|
|
841
823
|
async function prettify(code, options = {}) {
|
|
842
824
|
try {
|
|
843
|
-
return await
|
|
825
|
+
return await prettier.format(code, {
|
|
844
826
|
printWidth: 100,
|
|
845
827
|
singleQuote: true,
|
|
846
828
|
tabWidth: 4,
|
|
@@ -855,7 +837,7 @@ ${code}`);
|
|
|
855
837
|
}
|
|
856
838
|
}
|
|
857
839
|
function prettifyHtml(html) {
|
|
858
|
-
return
|
|
840
|
+
return htmlBeautify(
|
|
859
841
|
html.split("\n").map((line) => line.trim()).join(""),
|
|
860
842
|
{
|
|
861
843
|
indent_size: 2,
|
|
@@ -868,83 +850,85 @@ function removeComments(code) {
|
|
|
868
850
|
(line) => !(line.includes("// @ts-expect-error ") || line.includes("// @ts-ignore") || line.includes("{/* @ts-ignore */}"))
|
|
869
851
|
).join("\n");
|
|
870
852
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
853
|
+
export {
|
|
854
|
+
CSS_EXTENSION,
|
|
855
|
+
GenerateTarget,
|
|
856
|
+
Import,
|
|
857
|
+
Imports,
|
|
858
|
+
ImportsFor,
|
|
859
|
+
JAY_4_REACT,
|
|
860
|
+
JAY_COMPONENT,
|
|
861
|
+
JAY_CONTRACT_DTS_EXTENSION,
|
|
862
|
+
JAY_CONTRACT_EXTENSION,
|
|
863
|
+
JAY_DTS_EXTENSION,
|
|
864
|
+
JAY_EXTENSION,
|
|
865
|
+
JAY_FULLSTACK_COMPONENTS,
|
|
866
|
+
JAY_QUERY_MAIN_SANDBOX,
|
|
867
|
+
JAY_QUERY_MAIN_SANDBOX_TS,
|
|
868
|
+
JAY_QUERY_PREFIX,
|
|
869
|
+
JAY_QUERY_WORKER_SANDBOX,
|
|
870
|
+
JAY_QUERY_WORKER_SANDBOX_TS,
|
|
871
|
+
JAY_QUERY_WORKER_TRUSTED,
|
|
872
|
+
JAY_QUERY_WORKER_TRUSTED_TS,
|
|
873
|
+
JAY_RUNTIME,
|
|
874
|
+
JAY_SECURE,
|
|
875
|
+
JAY_TS_EXTENSION,
|
|
876
|
+
JayArrayType,
|
|
877
|
+
JayAtomicType,
|
|
878
|
+
JayBoolean,
|
|
879
|
+
JayComponentApiMember,
|
|
880
|
+
JayComponentType,
|
|
881
|
+
JayDate,
|
|
882
|
+
JayElementConstructorType,
|
|
883
|
+
JayElementType,
|
|
884
|
+
JayEnumType,
|
|
885
|
+
JayHTMLType,
|
|
886
|
+
JayImportedType,
|
|
887
|
+
JayNumber,
|
|
888
|
+
JayObjectType,
|
|
889
|
+
JayString,
|
|
890
|
+
JayTypeAlias,
|
|
891
|
+
JayTypeKind,
|
|
892
|
+
JayUnionType,
|
|
893
|
+
JayUnknown,
|
|
894
|
+
MAKE_JAY_4_REACT_COMPONENT,
|
|
895
|
+
MAKE_JAY_COMPONENT,
|
|
896
|
+
MAKE_JAY_TSX_COMPONENT,
|
|
897
|
+
REACT,
|
|
898
|
+
RenderFragment,
|
|
899
|
+
RuntimeMode,
|
|
900
|
+
SourceFileFormat,
|
|
901
|
+
TSX_EXTENSION,
|
|
902
|
+
TS_EXTENSION,
|
|
903
|
+
WithValidations,
|
|
904
|
+
checkValidationErrors,
|
|
905
|
+
equalJayTypes,
|
|
906
|
+
getJayTsFileSourcePath,
|
|
907
|
+
getMode,
|
|
908
|
+
getModeFileExtension,
|
|
909
|
+
getModeFromExtension,
|
|
910
|
+
hasExtension,
|
|
911
|
+
hasJayModeExtension,
|
|
912
|
+
hasRefs,
|
|
913
|
+
isArrayType,
|
|
914
|
+
isAtomicType,
|
|
915
|
+
isComponentType,
|
|
916
|
+
isElementConstructorType,
|
|
917
|
+
isElementType,
|
|
918
|
+
isEnumType,
|
|
919
|
+
isHTMLType,
|
|
920
|
+
isImportedType,
|
|
921
|
+
isObjectType,
|
|
922
|
+
isTypeAliasType,
|
|
923
|
+
isUnionType,
|
|
924
|
+
mergeRefsTrees,
|
|
925
|
+
mkRef,
|
|
926
|
+
mkRefsTree,
|
|
927
|
+
nestRefs,
|
|
928
|
+
prettify,
|
|
929
|
+
prettifyHtml,
|
|
930
|
+
removeComments,
|
|
931
|
+
resolvePrimitiveType,
|
|
932
|
+
withOriginalTrace,
|
|
933
|
+
withoutExtension
|
|
934
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-shared",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "",
|
|
5
6
|
"license": "Apache-2.0",
|
|
6
7
|
"main": "dist/index.js",
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
"build": "npm run build:js && npm run build:types",
|
|
16
17
|
"build:watch": "npm run build:js -- --watch & npm run build:types -- --watch",
|
|
17
18
|
"build:js": "vite build",
|
|
18
|
-
"build:types": "tsup lib/index.ts --dts-only --format
|
|
19
|
+
"build:types": "tsup lib/index.ts --dts-only --format esm",
|
|
19
20
|
"build:check-types": "tsc",
|
|
20
21
|
"clean": "rimraf dist",
|
|
21
22
|
"confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
},
|
|
25
26
|
"author": "",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@jay-framework/component": "^0.6.
|
|
28
|
-
"@jay-framework/runtime": "^0.6.
|
|
29
|
-
"@jay-framework/secure": "^0.6.
|
|
28
|
+
"@jay-framework/component": "^0.6.8",
|
|
29
|
+
"@jay-framework/runtime": "^0.6.8",
|
|
30
|
+
"@jay-framework/secure": "^0.6.8",
|
|
30
31
|
"@types/js-yaml": "^4.0.9",
|
|
31
32
|
"change-case": "^4.1.2",
|
|
32
33
|
"js-beautify": "^1.14.11",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@caiogondim/strip-margin": "^1.0.0",
|
|
42
|
-
"@jay-framework/dev-environment": "^0.6.
|
|
43
|
+
"@jay-framework/dev-environment": "^0.6.8",
|
|
43
44
|
"@testing-library/jest-dom": "^6.2.0",
|
|
44
45
|
"@types/js-beautify": "^1",
|
|
45
46
|
"@types/node": "^20.11.5",
|