@514labs/moose-lib 0.6.260-ci-5-g3b5261dd → 0.6.260-ci-2-g1b93253f
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/browserCompatible.js +52 -3
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +52 -3
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js +73 -14
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs +73 -14
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dmv2/index.js +52 -3
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +52 -3
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +54 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -3
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +44 -3
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +44 -3
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compilerPlugin.js
CHANGED
|
@@ -146,8 +146,49 @@ function isTruthy(value) {
|
|
|
146
146
|
return false;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
if (!
|
|
149
|
+
function parseLogLevel(value) {
|
|
150
|
+
if (!value) return "Info" /* Info */;
|
|
151
|
+
const normalized = value.trim();
|
|
152
|
+
switch (normalized) {
|
|
153
|
+
case "Debug":
|
|
154
|
+
case "debug":
|
|
155
|
+
case "DEBUG":
|
|
156
|
+
return "Debug" /* Debug */;
|
|
157
|
+
case "Info":
|
|
158
|
+
case "info":
|
|
159
|
+
case "INFO":
|
|
160
|
+
return "Info" /* Info */;
|
|
161
|
+
case "Warn":
|
|
162
|
+
case "warn":
|
|
163
|
+
case "WARN":
|
|
164
|
+
return "Warn" /* Warn */;
|
|
165
|
+
case "Error":
|
|
166
|
+
case "error":
|
|
167
|
+
case "ERROR":
|
|
168
|
+
return "Error" /* Error */;
|
|
169
|
+
default:
|
|
170
|
+
return "Info" /* Info */;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
var cachedLogLevel = null;
|
|
174
|
+
function getLogLevel() {
|
|
175
|
+
if (cachedLogLevel === null) {
|
|
176
|
+
cachedLogLevel = parseLogLevel(process.env.MOOSE_LOGGER__LEVEL);
|
|
177
|
+
}
|
|
178
|
+
return cachedLogLevel;
|
|
179
|
+
}
|
|
180
|
+
var compilerLog = (message, level = "Debug" /* Debug */) => {
|
|
181
|
+
if (isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const currentLevel = getLogLevel();
|
|
185
|
+
const levelPriority = {
|
|
186
|
+
["Debug" /* Debug */]: 0,
|
|
187
|
+
["Info" /* Info */]: 1,
|
|
188
|
+
["Warn" /* Warn */]: 2,
|
|
189
|
+
["Error" /* Error */]: 3
|
|
190
|
+
};
|
|
191
|
+
if (levelPriority[level] >= levelPriority[currentLevel]) {
|
|
151
192
|
console.log(message);
|
|
152
193
|
}
|
|
153
194
|
};
|
|
@@ -1658,14 +1699,20 @@ var createTypiaImport = () => import_typescript6.factory.createImportDeclaration
|
|
|
1658
1699
|
);
|
|
1659
1700
|
var applyTransformation = (node, typeChecker) => {
|
|
1660
1701
|
if (isCreateApi(node, typeChecker)) {
|
|
1661
|
-
compilerLog(
|
|
1702
|
+
compilerLog(
|
|
1703
|
+
"[CompilerPlugin] Found legacy API, transforming...",
|
|
1704
|
+
"Debug" /* Debug */
|
|
1705
|
+
);
|
|
1662
1706
|
return {
|
|
1663
1707
|
transformed: transformLegacyApi(node, typeChecker),
|
|
1664
1708
|
wasTransformed: true
|
|
1665
1709
|
};
|
|
1666
1710
|
}
|
|
1667
1711
|
if (isCreateApiV2(node, typeChecker)) {
|
|
1668
|
-
compilerLog(
|
|
1712
|
+
compilerLog(
|
|
1713
|
+
"[CompilerPlugin] Found API v2, transforming...",
|
|
1714
|
+
"Debug" /* Debug */
|
|
1715
|
+
);
|
|
1669
1716
|
return {
|
|
1670
1717
|
transformed: transformCreateApi(node, typeChecker),
|
|
1671
1718
|
wasTransformed: true
|
|
@@ -1673,7 +1720,8 @@ var applyTransformation = (node, typeChecker) => {
|
|
|
1673
1720
|
}
|
|
1674
1721
|
if (isNewMooseResourceWithTypeParam(node, typeChecker)) {
|
|
1675
1722
|
compilerLog(
|
|
1676
|
-
"[CompilerPlugin] Found Moose resource with type param, transforming..."
|
|
1723
|
+
"[CompilerPlugin] Found Moose resource with type param, transforming...",
|
|
1724
|
+
"Debug" /* Debug */
|
|
1677
1725
|
);
|
|
1678
1726
|
return {
|
|
1679
1727
|
transformed: transformNewMooseResource(node, typeChecker),
|
|
@@ -1697,18 +1745,23 @@ var hasExistingTypiaImport = (sourceFile) => {
|
|
|
1697
1745
|
return false;
|
|
1698
1746
|
});
|
|
1699
1747
|
compilerLog(
|
|
1700
|
-
`[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}
|
|
1748
|
+
`[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}`,
|
|
1749
|
+
"Debug" /* Debug */
|
|
1701
1750
|
);
|
|
1702
1751
|
return hasImport;
|
|
1703
1752
|
};
|
|
1704
1753
|
var addTypiaImport = (sourceFile) => {
|
|
1705
1754
|
if (hasExistingTypiaImport(sourceFile)) {
|
|
1706
1755
|
compilerLog(
|
|
1707
|
-
`[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping
|
|
1756
|
+
`[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping...`,
|
|
1757
|
+
"Debug" /* Debug */
|
|
1708
1758
|
);
|
|
1709
1759
|
return sourceFile;
|
|
1710
1760
|
}
|
|
1711
|
-
compilerLog(
|
|
1761
|
+
compilerLog(
|
|
1762
|
+
`[CompilerPlugin] Adding typia import to ${sourceFile.fileName}`,
|
|
1763
|
+
"Debug" /* Debug */
|
|
1764
|
+
);
|
|
1712
1765
|
const statementsWithImport = import_typescript6.factory.createNodeArray([
|
|
1713
1766
|
createTypiaImport(),
|
|
1714
1767
|
...sourceFile.statements
|
|
@@ -1718,7 +1771,8 @@ var addTypiaImport = (sourceFile) => {
|
|
|
1718
1771
|
var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
1719
1772
|
compilerLog(
|
|
1720
1773
|
`
|
|
1721
|
-
[CompilerPlugin] ========== Processing file: ${sourceFile.fileName}
|
|
1774
|
+
[CompilerPlugin] ========== Processing file: ${sourceFile.fileName} ==========`,
|
|
1775
|
+
"Debug" /* Debug */
|
|
1722
1776
|
);
|
|
1723
1777
|
let transformationCount = 0;
|
|
1724
1778
|
let hasTypiaTransformations = false;
|
|
@@ -1731,7 +1785,8 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
|
1731
1785
|
transformationCount++;
|
|
1732
1786
|
hasTypiaTransformations = true;
|
|
1733
1787
|
compilerLog(
|
|
1734
|
-
`[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}
|
|
1788
|
+
`[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}`,
|
|
1789
|
+
"Debug" /* Debug */
|
|
1735
1790
|
);
|
|
1736
1791
|
}
|
|
1737
1792
|
return import_typescript6.default.visitEachChild(transformed, visitNode, void 0);
|
|
@@ -1742,22 +1797,26 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
|
1742
1797
|
void 0
|
|
1743
1798
|
);
|
|
1744
1799
|
compilerLog(
|
|
1745
|
-
`[CompilerPlugin] Total transformations applied: ${transformationCount}
|
|
1800
|
+
`[CompilerPlugin] Total transformations applied: ${transformationCount}`,
|
|
1801
|
+
"Debug" /* Debug */
|
|
1746
1802
|
);
|
|
1747
1803
|
compilerLog(
|
|
1748
|
-
`[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}
|
|
1804
|
+
`[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}`,
|
|
1805
|
+
"Debug" /* Debug */
|
|
1749
1806
|
);
|
|
1750
1807
|
if (hasTypiaTransformations) {
|
|
1751
1808
|
const result = addTypiaImport(transformedSourceFile);
|
|
1752
1809
|
compilerLog(
|
|
1753
1810
|
`[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (with import) ==========
|
|
1754
|
-
|
|
1811
|
+
`,
|
|
1812
|
+
"Debug" /* Debug */
|
|
1755
1813
|
);
|
|
1756
1814
|
return result;
|
|
1757
1815
|
} else {
|
|
1758
1816
|
compilerLog(
|
|
1759
1817
|
`[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (no import needed) ==========
|
|
1760
|
-
|
|
1818
|
+
`,
|
|
1819
|
+
"Debug" /* Debug */
|
|
1761
1820
|
);
|
|
1762
1821
|
return transformedSourceFile;
|
|
1763
1822
|
}
|