@514labs/moose-lib 0.6.260-ci-2-g1b93253f → 0.6.261

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.
@@ -111,49 +111,8 @@ function isTruthy(value) {
111
111
  return false;
112
112
  }
113
113
  }
114
- function parseLogLevel(value) {
115
- if (!value) return "Info" /* Info */;
116
- const normalized = value.trim();
117
- switch (normalized) {
118
- case "Debug":
119
- case "debug":
120
- case "DEBUG":
121
- return "Debug" /* Debug */;
122
- case "Info":
123
- case "info":
124
- case "INFO":
125
- return "Info" /* Info */;
126
- case "Warn":
127
- case "warn":
128
- case "WARN":
129
- return "Warn" /* Warn */;
130
- case "Error":
131
- case "error":
132
- case "ERROR":
133
- return "Error" /* Error */;
134
- default:
135
- return "Info" /* Info */;
136
- }
137
- }
138
- var cachedLogLevel = null;
139
- function getLogLevel() {
140
- if (cachedLogLevel === null) {
141
- cachedLogLevel = parseLogLevel(process.env.MOOSE_LOGGER__LEVEL);
142
- }
143
- return cachedLogLevel;
144
- }
145
- var compilerLog = (message, level = "Debug" /* Debug */) => {
146
- if (isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
147
- return;
148
- }
149
- const currentLevel = getLogLevel();
150
- const levelPriority = {
151
- ["Debug" /* Debug */]: 0,
152
- ["Info" /* Info */]: 1,
153
- ["Warn" /* Warn */]: 2,
154
- ["Error" /* Error */]: 3
155
- };
156
- if (levelPriority[level] >= levelPriority[currentLevel]) {
114
+ var compilerLog = (message) => {
115
+ if (!isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
157
116
  console.log(message);
158
117
  }
159
118
  };
@@ -1669,20 +1628,14 @@ var createTypiaImport = () => factory4.createImportDeclaration(
1669
1628
  );
1670
1629
  var applyTransformation = (node, typeChecker) => {
1671
1630
  if (isCreateApi(node, typeChecker)) {
1672
- compilerLog(
1673
- "[CompilerPlugin] Found legacy API, transforming...",
1674
- "Debug" /* Debug */
1675
- );
1631
+ compilerLog("[CompilerPlugin] Found legacy API, transforming...");
1676
1632
  return {
1677
1633
  transformed: transformLegacyApi(node, typeChecker),
1678
1634
  wasTransformed: true
1679
1635
  };
1680
1636
  }
1681
1637
  if (isCreateApiV2(node, typeChecker)) {
1682
- compilerLog(
1683
- "[CompilerPlugin] Found API v2, transforming...",
1684
- "Debug" /* Debug */
1685
- );
1638
+ compilerLog("[CompilerPlugin] Found API v2, transforming...");
1686
1639
  return {
1687
1640
  transformed: transformCreateApi(node, typeChecker),
1688
1641
  wasTransformed: true
@@ -1690,8 +1643,7 @@ var applyTransformation = (node, typeChecker) => {
1690
1643
  }
1691
1644
  if (isNewMooseResourceWithTypeParam(node, typeChecker)) {
1692
1645
  compilerLog(
1693
- "[CompilerPlugin] Found Moose resource with type param, transforming...",
1694
- "Debug" /* Debug */
1646
+ "[CompilerPlugin] Found Moose resource with type param, transforming..."
1695
1647
  );
1696
1648
  return {
1697
1649
  transformed: transformNewMooseResource(node, typeChecker),
@@ -1715,23 +1667,18 @@ var hasExistingTypiaImport = (sourceFile) => {
1715
1667
  return false;
1716
1668
  });
1717
1669
  compilerLog(
1718
- `[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}`,
1719
- "Debug" /* Debug */
1670
+ `[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}`
1720
1671
  );
1721
1672
  return hasImport;
1722
1673
  };
1723
1674
  var addTypiaImport = (sourceFile) => {
1724
1675
  if (hasExistingTypiaImport(sourceFile)) {
1725
1676
  compilerLog(
1726
- `[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping...`,
1727
- "Debug" /* Debug */
1677
+ `[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping...`
1728
1678
  );
1729
1679
  return sourceFile;
1730
1680
  }
1731
- compilerLog(
1732
- `[CompilerPlugin] Adding typia import to ${sourceFile.fileName}`,
1733
- "Debug" /* Debug */
1734
- );
1681
+ compilerLog(`[CompilerPlugin] Adding typia import to ${sourceFile.fileName}`);
1735
1682
  const statementsWithImport = factory4.createNodeArray([
1736
1683
  createTypiaImport(),
1737
1684
  ...sourceFile.statements
@@ -1741,8 +1688,7 @@ var addTypiaImport = (sourceFile) => {
1741
1688
  var transform = (typeChecker) => (_context) => (sourceFile) => {
1742
1689
  compilerLog(
1743
1690
  `
1744
- [CompilerPlugin] ========== Processing file: ${sourceFile.fileName} ==========`,
1745
- "Debug" /* Debug */
1691
+ [CompilerPlugin] ========== Processing file: ${sourceFile.fileName} ==========`
1746
1692
  );
1747
1693
  let transformationCount = 0;
1748
1694
  let hasTypiaTransformations = false;
@@ -1755,8 +1701,7 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
1755
1701
  transformationCount++;
1756
1702
  hasTypiaTransformations = true;
1757
1703
  compilerLog(
1758
- `[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}`,
1759
- "Debug" /* Debug */
1704
+ `[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}`
1760
1705
  );
1761
1706
  }
1762
1707
  return ts6.visitEachChild(transformed, visitNode, void 0);
@@ -1767,26 +1712,22 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
1767
1712
  void 0
1768
1713
  );
1769
1714
  compilerLog(
1770
- `[CompilerPlugin] Total transformations applied: ${transformationCount}`,
1771
- "Debug" /* Debug */
1715
+ `[CompilerPlugin] Total transformations applied: ${transformationCount}`
1772
1716
  );
1773
1717
  compilerLog(
1774
- `[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}`,
1775
- "Debug" /* Debug */
1718
+ `[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}`
1776
1719
  );
1777
1720
  if (hasTypiaTransformations) {
1778
1721
  const result = addTypiaImport(transformedSourceFile);
1779
1722
  compilerLog(
1780
1723
  `[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (with import) ==========
1781
- `,
1782
- "Debug" /* Debug */
1724
+ `
1783
1725
  );
1784
1726
  return result;
1785
1727
  } else {
1786
1728
  compilerLog(
1787
1729
  `[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (no import needed) ==========
1788
- `,
1789
- "Debug" /* Debug */
1730
+ `
1790
1731
  );
1791
1732
  return transformedSourceFile;
1792
1733
  }