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