@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.
- package/dist/browserCompatible.js +4 -63
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +4 -63
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js +14 -73
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs +14 -73
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dmv2/index.js +4 -63
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +4 -63
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -18
- package/dist/index.d.ts +2 -18
- package/dist/index.js +5 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -79
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +6 -86
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +6 -86
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/compilerPlugin.js
CHANGED
|
@@ -146,49 +146,8 @@ function isTruthy(value) {
|
|
|
146
146
|
return false;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
if (!
|
|
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]) {
|
|
149
|
+
var compilerLog = (message) => {
|
|
150
|
+
if (!isTruthy(process.env.MOOSE_DISABLE_COMPILER_LOGS)) {
|
|
192
151
|
console.log(message);
|
|
193
152
|
}
|
|
194
153
|
};
|
|
@@ -1699,20 +1658,14 @@ var createTypiaImport = () => import_typescript6.factory.createImportDeclaration
|
|
|
1699
1658
|
);
|
|
1700
1659
|
var applyTransformation = (node, typeChecker) => {
|
|
1701
1660
|
if (isCreateApi(node, typeChecker)) {
|
|
1702
|
-
compilerLog(
|
|
1703
|
-
"[CompilerPlugin] Found legacy API, transforming...",
|
|
1704
|
-
"Debug" /* Debug */
|
|
1705
|
-
);
|
|
1661
|
+
compilerLog("[CompilerPlugin] Found legacy API, transforming...");
|
|
1706
1662
|
return {
|
|
1707
1663
|
transformed: transformLegacyApi(node, typeChecker),
|
|
1708
1664
|
wasTransformed: true
|
|
1709
1665
|
};
|
|
1710
1666
|
}
|
|
1711
1667
|
if (isCreateApiV2(node, typeChecker)) {
|
|
1712
|
-
compilerLog(
|
|
1713
|
-
"[CompilerPlugin] Found API v2, transforming...",
|
|
1714
|
-
"Debug" /* Debug */
|
|
1715
|
-
);
|
|
1668
|
+
compilerLog("[CompilerPlugin] Found API v2, transforming...");
|
|
1716
1669
|
return {
|
|
1717
1670
|
transformed: transformCreateApi(node, typeChecker),
|
|
1718
1671
|
wasTransformed: true
|
|
@@ -1720,8 +1673,7 @@ var applyTransformation = (node, typeChecker) => {
|
|
|
1720
1673
|
}
|
|
1721
1674
|
if (isNewMooseResourceWithTypeParam(node, typeChecker)) {
|
|
1722
1675
|
compilerLog(
|
|
1723
|
-
"[CompilerPlugin] Found Moose resource with type param, transforming..."
|
|
1724
|
-
"Debug" /* Debug */
|
|
1676
|
+
"[CompilerPlugin] Found Moose resource with type param, transforming..."
|
|
1725
1677
|
);
|
|
1726
1678
|
return {
|
|
1727
1679
|
transformed: transformNewMooseResource(node, typeChecker),
|
|
@@ -1745,23 +1697,18 @@ var hasExistingTypiaImport = (sourceFile) => {
|
|
|
1745
1697
|
return false;
|
|
1746
1698
|
});
|
|
1747
1699
|
compilerLog(
|
|
1748
|
-
`[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}
|
|
1749
|
-
"Debug" /* Debug */
|
|
1700
|
+
`[CompilerPlugin] Checking for existing typia import (${avoidTypiaNameClash}) in ${sourceFile.fileName}: ${hasImport}`
|
|
1750
1701
|
);
|
|
1751
1702
|
return hasImport;
|
|
1752
1703
|
};
|
|
1753
1704
|
var addTypiaImport = (sourceFile) => {
|
|
1754
1705
|
if (hasExistingTypiaImport(sourceFile)) {
|
|
1755
1706
|
compilerLog(
|
|
1756
|
-
`[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping
|
|
1757
|
-
"Debug" /* Debug */
|
|
1707
|
+
`[CompilerPlugin] Typia import already exists in ${sourceFile.fileName}, skipping...`
|
|
1758
1708
|
);
|
|
1759
1709
|
return sourceFile;
|
|
1760
1710
|
}
|
|
1761
|
-
compilerLog(
|
|
1762
|
-
`[CompilerPlugin] Adding typia import to ${sourceFile.fileName}`,
|
|
1763
|
-
"Debug" /* Debug */
|
|
1764
|
-
);
|
|
1711
|
+
compilerLog(`[CompilerPlugin] Adding typia import to ${sourceFile.fileName}`);
|
|
1765
1712
|
const statementsWithImport = import_typescript6.factory.createNodeArray([
|
|
1766
1713
|
createTypiaImport(),
|
|
1767
1714
|
...sourceFile.statements
|
|
@@ -1771,8 +1718,7 @@ var addTypiaImport = (sourceFile) => {
|
|
|
1771
1718
|
var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
1772
1719
|
compilerLog(
|
|
1773
1720
|
`
|
|
1774
|
-
[CompilerPlugin] ========== Processing file: ${sourceFile.fileName}
|
|
1775
|
-
"Debug" /* Debug */
|
|
1721
|
+
[CompilerPlugin] ========== Processing file: ${sourceFile.fileName} ==========`
|
|
1776
1722
|
);
|
|
1777
1723
|
let transformationCount = 0;
|
|
1778
1724
|
let hasTypiaTransformations = false;
|
|
@@ -1785,8 +1731,7 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
|
1785
1731
|
transformationCount++;
|
|
1786
1732
|
hasTypiaTransformations = true;
|
|
1787
1733
|
compilerLog(
|
|
1788
|
-
`[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}
|
|
1789
|
-
"Debug" /* Debug */
|
|
1734
|
+
`[CompilerPlugin] Transformation #${transformationCount} applied at position ${node.pos}`
|
|
1790
1735
|
);
|
|
1791
1736
|
}
|
|
1792
1737
|
return import_typescript6.default.visitEachChild(transformed, visitNode, void 0);
|
|
@@ -1797,26 +1742,22 @@ var transform = (typeChecker) => (_context) => (sourceFile) => {
|
|
|
1797
1742
|
void 0
|
|
1798
1743
|
);
|
|
1799
1744
|
compilerLog(
|
|
1800
|
-
`[CompilerPlugin] Total transformations applied: ${transformationCount}
|
|
1801
|
-
"Debug" /* Debug */
|
|
1745
|
+
`[CompilerPlugin] Total transformations applied: ${transformationCount}`
|
|
1802
1746
|
);
|
|
1803
1747
|
compilerLog(
|
|
1804
|
-
`[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}
|
|
1805
|
-
"Debug" /* Debug */
|
|
1748
|
+
`[CompilerPlugin] Needs typia import: ${hasTypiaTransformations}`
|
|
1806
1749
|
);
|
|
1807
1750
|
if (hasTypiaTransformations) {
|
|
1808
1751
|
const result = addTypiaImport(transformedSourceFile);
|
|
1809
1752
|
compilerLog(
|
|
1810
1753
|
`[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (with import) ==========
|
|
1811
|
-
|
|
1812
|
-
"Debug" /* Debug */
|
|
1754
|
+
`
|
|
1813
1755
|
);
|
|
1814
1756
|
return result;
|
|
1815
1757
|
} else {
|
|
1816
1758
|
compilerLog(
|
|
1817
1759
|
`[CompilerPlugin] ========== Completed processing ${sourceFile.fileName} (no import needed) ==========
|
|
1818
|
-
|
|
1819
|
-
"Debug" /* Debug */
|
|
1760
|
+
`
|
|
1820
1761
|
);
|
|
1821
1762
|
return transformedSourceFile;
|
|
1822
1763
|
}
|