@jay-framework/compiler-shared 0.6.6 → 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.d.ts +4 -2
- package/dist/index.js +92 -105
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare class Imports {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
declare const JAY_EXTENSION = ".jay-html";
|
|
78
|
+
declare const CSS_EXTENSION = ".css";
|
|
78
79
|
declare const JAY_CONTRACT_EXTENSION = ".jay-contract";
|
|
79
80
|
declare const JAY_TS_EXTENSION = ".jay-html.ts";
|
|
80
81
|
declare const JAY_DTS_EXTENSION = ".jay-html.d.ts";
|
|
@@ -255,7 +256,8 @@ declare enum SourceFileFormat {
|
|
|
255
256
|
JayHtml = "jay-html",
|
|
256
257
|
JayTsx = "jay-tsx",
|
|
257
258
|
JayContract = "jay-contract",
|
|
258
|
-
TypeScript = "typeScript"
|
|
259
|
+
TypeScript = "typeScript",
|
|
260
|
+
CSS = "css"
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
interface ImportedRefsTree {
|
|
@@ -315,4 +317,4 @@ declare function prettify(code: string, options?: prettier.Options): Promise<str
|
|
|
315
317
|
declare function prettifyHtml(html: string): string;
|
|
316
318
|
declare function removeComments(code: string): string;
|
|
317
319
|
|
|
318
|
-
export { type CompilerSourceFile, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, REACT, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, checkValidationErrors, equalJayTypes, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isObjectType, isTypeAliasType, isUnionType, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, prettify, prettifyHtml, removeComments, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
|
320
|
+
export { CSS_EXTENSION, type CompilerSourceFile, GenerateTarget, type GenericTypescriptSourceFile, Import, type ImportName, type ImportedRefsTree, Imports, ImportsFor, JAY_4_REACT, JAY_COMPONENT, JAY_CONTRACT_DTS_EXTENSION, JAY_CONTRACT_EXTENSION, JAY_DTS_EXTENSION, JAY_EXTENSION, JAY_FULLSTACK_COMPONENTS, JAY_QUERY_MAIN_SANDBOX, JAY_QUERY_MAIN_SANDBOX_TS, JAY_QUERY_PREFIX, JAY_QUERY_WORKER_SANDBOX, JAY_QUERY_WORKER_SANDBOX_TS, JAY_QUERY_WORKER_TRUSTED, JAY_QUERY_WORKER_TRUSTED_TS, JAY_RUNTIME, JAY_SECURE, JAY_TS_EXTENSION, JayArrayType, JayAtomicType, JayBoolean, JayComponentApiMember, JayComponentType, JayDate, JayElementConstructorType, JayElementType, JayEnumType, JayHTMLType, type JayImportLink, type JayImportName, JayImportedType, JayNumber, JayObjectType, JayString, type JayType, JayTypeAlias, JayTypeKind, JayUnionType, JayUnknown, type JayValidations, MAKE_JAY_4_REACT_COMPONENT, MAKE_JAY_COMPONENT, MAKE_JAY_TSX_COMPONENT, type MainRuntimeModes, REACT, type Ref, type RefsTree, RenderFragment, RuntimeMode, SourceFileFormat, TSX_EXTENSION, TS_EXTENSION, WithValidations, checkValidationErrors, equalJayTypes, getJayTsFileSourcePath, getMode, getModeFileExtension, getModeFromExtension, hasExtension, hasJayModeExtension, hasRefs, isArrayType, isAtomicType, isComponentType, isElementConstructorType, isElementType, isEnumType, isHTMLType, isImportedType, isObjectType, isTypeAliasType, isUnionType, mergeRefsTrees, mkRef, mkRefsTree, nestRefs, prettify, prettifyHtml, removeComments, resolvePrimitiveType, withOriginalTrace, withoutExtension };
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
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";
|
|
10
|
+
const CSS_EXTENSION = ".css";
|
|
29
11
|
const JAY_CONTRACT_EXTENSION = ".jay-contract";
|
|
30
12
|
const JAY_TS_EXTENSION = ".jay-html.ts";
|
|
31
13
|
const JAY_DTS_EXTENSION = ".jay-html.d.ts";
|
|
@@ -46,8 +28,8 @@ var ImportsFor = /* @__PURE__ */ ((ImportsFor2) => {
|
|
|
46
28
|
return ImportsFor2;
|
|
47
29
|
})(ImportsFor || {});
|
|
48
30
|
let nextKey = 0;
|
|
49
|
-
function importStatementFragment(
|
|
50
|
-
return { module
|
|
31
|
+
function importStatementFragment(module, statement, ...usage) {
|
|
32
|
+
return { module, index: nextKey++, statement, usage };
|
|
51
33
|
}
|
|
52
34
|
const importsOrder = {
|
|
53
35
|
JAY_RUNTIME: 1,
|
|
@@ -410,7 +392,7 @@ class Imports {
|
|
|
410
392
|
(a, b) => (importsOrder[a] || 999) - (importsOrder[b] || 999)
|
|
411
393
|
);
|
|
412
394
|
return modulesToImport.map(
|
|
413
|
-
(
|
|
395
|
+
(module) => `import {${moduleImportStatements.get(module).join(", ")}} from "${module}";`
|
|
414
396
|
).join("\n");
|
|
415
397
|
}
|
|
416
398
|
static none() {
|
|
@@ -733,6 +715,7 @@ var SourceFileFormat = /* @__PURE__ */ ((SourceFileFormat2) => {
|
|
|
733
715
|
SourceFileFormat2["JayTsx"] = "jay-tsx";
|
|
734
716
|
SourceFileFormat2["JayContract"] = "jay-contract";
|
|
735
717
|
SourceFileFormat2["TypeScript"] = "typeScript";
|
|
718
|
+
SourceFileFormat2["CSS"] = "css";
|
|
736
719
|
return SourceFileFormat2;
|
|
737
720
|
})(SourceFileFormat || {});
|
|
738
721
|
function mergeRefsTrees(...trees) {
|
|
@@ -836,9 +819,10 @@ Caused by
|
|
|
836
819
|
${originalError.stack}`;
|
|
837
820
|
return error;
|
|
838
821
|
}
|
|
822
|
+
const { html: htmlBeautify } = jsBeautify;
|
|
839
823
|
async function prettify(code, options = {}) {
|
|
840
824
|
try {
|
|
841
|
-
return await
|
|
825
|
+
return await prettier.format(code, {
|
|
842
826
|
printWidth: 100,
|
|
843
827
|
singleQuote: true,
|
|
844
828
|
tabWidth: 4,
|
|
@@ -853,7 +837,7 @@ ${code}`);
|
|
|
853
837
|
}
|
|
854
838
|
}
|
|
855
839
|
function prettifyHtml(html) {
|
|
856
|
-
return
|
|
840
|
+
return htmlBeautify(
|
|
857
841
|
html.split("\n").map((line) => line.trim()).join(""),
|
|
858
842
|
{
|
|
859
843
|
indent_size: 2,
|
|
@@ -866,82 +850,85 @@ function removeComments(code) {
|
|
|
866
850
|
(line) => !(line.includes("// @ts-expect-error ") || line.includes("// @ts-ignore") || line.includes("{/* @ts-ignore */}"))
|
|
867
851
|
).join("\n");
|
|
868
852
|
}
|
|
869
|
-
|
|
870
|
-
|
|
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
|
-
|
|
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",
|