@bleedingdev/modern-js-code-tools 3.9.0-ultramodern.1 → 3.9.0-ultramodern.11
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/bin/modern-api-check-files.mjs +4 -0
- package/bin/modern-api-check.mjs +4 -0
- package/dist/cjs/cli/microvertical-api-check.cjs +71 -0
- package/dist/cjs/cli/oxlint.cjs +9 -5
- package/dist/cjs/microvertical-api-baseline.cjs +677 -0
- package/dist/cjs/microvertical-api-boundary.cjs +507 -0
- package/dist/cjs/microvertical-api-owner.cjs +217 -0
- package/dist/cjs/oxlint-plugin/rules/strict-effect-api-boundaries.cjs +7 -5
- package/dist/cjs/strict-effect-runtime.cjs +411 -0
- package/dist/esm/cli/microvertical-api-check.js +33 -0
- package/dist/esm/cli/oxlint.js +10 -6
- package/dist/esm/microvertical-api-baseline.js +621 -0
- package/dist/esm/microvertical-api-boundary.js +449 -0
- package/dist/esm/microvertical-api-owner.js +162 -0
- package/dist/esm/oxlint-plugin/rules/strict-effect-api-boundaries.js +7 -5
- package/dist/esm/strict-effect-runtime.js +358 -0
- package/dist/esm-node/cli/microvertical-api-check.js +34 -0
- package/dist/esm-node/cli/oxlint.js +10 -6
- package/dist/esm-node/microvertical-api-baseline.js +622 -0
- package/dist/esm-node/microvertical-api-boundary.js +450 -0
- package/dist/esm-node/microvertical-api-owner.js +163 -0
- package/dist/esm-node/oxlint-plugin/rules/strict-effect-api-boundaries.js +7 -5
- package/dist/esm-node/strict-effect-runtime.js +359 -0
- package/dist/types/cli/microvertical-api-check.d.ts +1 -0
- package/dist/types/microvertical-api-baseline.d.ts +28 -0
- package/dist/types/microvertical-api-boundary.d.ts +32 -0
- package/dist/types/microvertical-api-owner.d.ts +6 -0
- package/dist/types/strict-effect-runtime.d.ts +10 -0
- package/package.json +25 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { checkMicroVerticalApiBoundaries, checkMicroVerticalApiConsumerFiles } from "../microvertical-api-boundary.js";
|
|
2
|
+
function runMicroVerticalApiCheckCli(args = process.argv.slice(2), filesOnly = false) {
|
|
3
|
+
let workspaceRoot = process.env.ULTRAMODERN_WORKSPACE_ROOT ?? process.cwd();
|
|
4
|
+
let baselinePackageDirectory;
|
|
5
|
+
for(let index = 0; index < args.length; index += 1){
|
|
6
|
+
const argument = args[index];
|
|
7
|
+
if ('--help' === argument || '-h' === argument) {
|
|
8
|
+
console.log(`${filesOnly ? 'modern-api-check-files' : 'modern-api-check'} [--workspace-root <path>] [--baseline-package-directory <path>]\n${filesOnly ? 'Checks consumer files, contracts, package exports and owner identity. Does not analyze runtime topology; run the strict Effect source phase separately.' : 'Checks consumer files, contracts, package exports, owner identity and runtime topology once per API entry.'}\nWorkspace defaults to ULTRAMODERN_WORKSPACE_ROOT then cwd. Exit codes: 0 valid, 1 consumer violation, 2 tool/configuration failure.`);
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
if (![
|
|
12
|
+
'--workspace-root',
|
|
13
|
+
'--baseline-package-directory'
|
|
14
|
+
].includes(argument ?? '') || !args[index + 1] || args[index + 1]?.startsWith('--')) {
|
|
15
|
+
console.error(`Invalid argument: ${argument ?? ''}. Use --help.`);
|
|
16
|
+
return 2;
|
|
17
|
+
}
|
|
18
|
+
const value = args[++index];
|
|
19
|
+
if ('--workspace-root' === argument) workspaceRoot = value;
|
|
20
|
+
else baselinePackageDirectory = value;
|
|
21
|
+
}
|
|
22
|
+
const result = (filesOnly ? checkMicroVerticalApiConsumerFiles : checkMicroVerticalApiBoundaries)({
|
|
23
|
+
workspaceRoot,
|
|
24
|
+
baselinePackageDirectory
|
|
25
|
+
});
|
|
26
|
+
for (const diagnostic of result.diagnostics)console.error(`API violation: ${diagnostic}`);
|
|
27
|
+
for (const error of result.toolErrors)console.error(`API tool error: ${error}`);
|
|
28
|
+
if (result.toolErrors.length) return 2;
|
|
29
|
+
if (result.diagnostics.length) return 1;
|
|
30
|
+
console.log(`UltraModern API ${filesOnly ? 'consumer files' : 'boundary'} check passed.`);
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
export { runMicroVerticalApiCheckCli };
|
package/dist/esm/cli/oxlint.js
CHANGED
|
@@ -3,7 +3,7 @@ import node_fs from "node:fs";
|
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import node_os from "node:os";
|
|
5
5
|
import node_path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
const oxlint_require = createRequire(import.meta.url);
|
|
8
8
|
const ignoredDirectories = new Set([
|
|
9
9
|
'.modern',
|
|
@@ -73,22 +73,26 @@ const runOxlintRules = ({ cwd, targets, rules })=>{
|
|
|
73
73
|
stdout: '',
|
|
74
74
|
stderr: ''
|
|
75
75
|
};
|
|
76
|
+
const pluginPath = resolvePluginPath();
|
|
76
77
|
const tempDir = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), 'modern-code-tools-oxlint-'));
|
|
77
78
|
const configPath = node_path.join(tempDir, 'oxlint.config.mjs');
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const adapterPath = node_path.join(tempDir, 'oxlint-plugin.mjs');
|
|
80
|
+
try {
|
|
81
|
+
node_fs.writeFileSync(adapterPath, `import plugin from ${JSON.stringify(pathToFileURL(pluginPath).href)};
|
|
82
|
+
export default plugin.rules ? plugin : plugin.default;
|
|
83
|
+
`, 'utf-8');
|
|
84
|
+
node_fs.writeFileSync(configPath, `export default {
|
|
85
|
+
jsPlugins: [${JSON.stringify(adapterPath)}],
|
|
81
86
|
rules: ${JSON.stringify(rules, null, 2)}
|
|
82
87
|
};
|
|
83
88
|
`, 'utf-8');
|
|
84
|
-
try {
|
|
85
89
|
const result = spawnSync(process.execPath, [
|
|
86
90
|
resolveOxlintBin(),
|
|
87
91
|
...resolvedTargets,
|
|
88
92
|
'--config',
|
|
89
93
|
configPath,
|
|
90
94
|
'--format',
|
|
91
|
-
'
|
|
95
|
+
'default',
|
|
92
96
|
'--quiet'
|
|
93
97
|
], {
|
|
94
98
|
cwd,
|