@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.
Files changed (2) hide show
  1. package/dist/index.js +90 -106
  2. 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
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
- const prettier = require("prettier");
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(module2, statement, ...usage) {
51
- return { module: module2, index: nextKey++, statement, usage };
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
- (module2) => `import {${moduleImportStatements.get(module2).join(", ")}} from "${module2}";`
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 prettier__namespace.format(code, {
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 jsBeautify.html(
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
- exports.CSS_EXTENSION = CSS_EXTENSION;
872
- exports.GenerateTarget = GenerateTarget;
873
- exports.Import = Import;
874
- exports.Imports = Imports;
875
- exports.ImportsFor = ImportsFor;
876
- exports.JAY_4_REACT = JAY_4_REACT;
877
- exports.JAY_COMPONENT = JAY_COMPONENT;
878
- exports.JAY_CONTRACT_DTS_EXTENSION = JAY_CONTRACT_DTS_EXTENSION;
879
- exports.JAY_CONTRACT_EXTENSION = JAY_CONTRACT_EXTENSION;
880
- exports.JAY_DTS_EXTENSION = JAY_DTS_EXTENSION;
881
- exports.JAY_EXTENSION = JAY_EXTENSION;
882
- exports.JAY_FULLSTACK_COMPONENTS = JAY_FULLSTACK_COMPONENTS;
883
- exports.JAY_QUERY_MAIN_SANDBOX = JAY_QUERY_MAIN_SANDBOX;
884
- exports.JAY_QUERY_MAIN_SANDBOX_TS = JAY_QUERY_MAIN_SANDBOX_TS;
885
- exports.JAY_QUERY_PREFIX = JAY_QUERY_PREFIX;
886
- exports.JAY_QUERY_WORKER_SANDBOX = JAY_QUERY_WORKER_SANDBOX;
887
- exports.JAY_QUERY_WORKER_SANDBOX_TS = JAY_QUERY_WORKER_SANDBOX_TS;
888
- exports.JAY_QUERY_WORKER_TRUSTED = JAY_QUERY_WORKER_TRUSTED;
889
- exports.JAY_QUERY_WORKER_TRUSTED_TS = JAY_QUERY_WORKER_TRUSTED_TS;
890
- exports.JAY_RUNTIME = JAY_RUNTIME;
891
- exports.JAY_SECURE = JAY_SECURE;
892
- exports.JAY_TS_EXTENSION = JAY_TS_EXTENSION;
893
- exports.JayArrayType = JayArrayType;
894
- exports.JayAtomicType = JayAtomicType;
895
- exports.JayBoolean = JayBoolean;
896
- exports.JayComponentApiMember = JayComponentApiMember;
897
- exports.JayComponentType = JayComponentType;
898
- exports.JayDate = JayDate;
899
- exports.JayElementConstructorType = JayElementConstructorType;
900
- exports.JayElementType = JayElementType;
901
- exports.JayEnumType = JayEnumType;
902
- exports.JayHTMLType = JayHTMLType;
903
- exports.JayImportedType = JayImportedType;
904
- exports.JayNumber = JayNumber;
905
- exports.JayObjectType = JayObjectType;
906
- exports.JayString = JayString;
907
- exports.JayTypeAlias = JayTypeAlias;
908
- exports.JayTypeKind = JayTypeKind;
909
- exports.JayUnionType = JayUnionType;
910
- exports.JayUnknown = JayUnknown;
911
- exports.MAKE_JAY_4_REACT_COMPONENT = MAKE_JAY_4_REACT_COMPONENT;
912
- exports.MAKE_JAY_COMPONENT = MAKE_JAY_COMPONENT;
913
- exports.MAKE_JAY_TSX_COMPONENT = MAKE_JAY_TSX_COMPONENT;
914
- exports.REACT = REACT;
915
- exports.RenderFragment = RenderFragment;
916
- exports.RuntimeMode = RuntimeMode;
917
- exports.SourceFileFormat = SourceFileFormat;
918
- exports.TSX_EXTENSION = TSX_EXTENSION;
919
- exports.TS_EXTENSION = TS_EXTENSION;
920
- exports.WithValidations = WithValidations;
921
- exports.checkValidationErrors = checkValidationErrors;
922
- exports.equalJayTypes = equalJayTypes;
923
- exports.getJayTsFileSourcePath = getJayTsFileSourcePath;
924
- exports.getMode = getMode;
925
- exports.getModeFileExtension = getModeFileExtension;
926
- exports.getModeFromExtension = getModeFromExtension;
927
- exports.hasExtension = hasExtension;
928
- exports.hasJayModeExtension = hasJayModeExtension;
929
- exports.hasRefs = hasRefs;
930
- exports.isArrayType = isArrayType;
931
- exports.isAtomicType = isAtomicType;
932
- exports.isComponentType = isComponentType;
933
- exports.isElementConstructorType = isElementConstructorType;
934
- exports.isElementType = isElementType;
935
- exports.isEnumType = isEnumType;
936
- exports.isHTMLType = isHTMLType;
937
- exports.isImportedType = isImportedType;
938
- exports.isObjectType = isObjectType;
939
- exports.isTypeAliasType = isTypeAliasType;
940
- exports.isUnionType = isUnionType;
941
- exports.mergeRefsTrees = mergeRefsTrees;
942
- exports.mkRef = mkRef;
943
- exports.mkRefsTree = mkRefsTree;
944
- exports.nestRefs = nestRefs;
945
- exports.prettify = prettify;
946
- exports.prettifyHtml = prettifyHtml;
947
- exports.removeComments = removeComments;
948
- exports.resolvePrimitiveType = resolvePrimitiveType;
949
- exports.withOriginalTrace = withOriginalTrace;
950
- exports.withoutExtension = withoutExtension;
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.7",
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 cjs",
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.7",
28
- "@jay-framework/runtime": "^0.6.7",
29
- "@jay-framework/secure": "^0.6.7",
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.7",
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",